Facebook Graph API Data Incorrect - facebook

Small problem here. I have an event created on Facebook and am using the Graph API to get the number of attendees.
I get the list of attendees with PHP from https://graph.facebook.com/EVENTID/attending?access_token=TOKENHERE and it returns a list of names.
However, the number of attendees is about 6 people lower than what is shown on the Facebook event page. Why would these numbers not match? Is there something in particular I'm supposed to do in the code to get the entire list?

As answered in the comments:
This discrepancy is probably down to a number of the attendees having opted out of Facebook Platform, which means their data isn't passed to apps via the API. Can't be 100% sure without the Event ID, but its a likely reason. – Simon Cross

From the Graph API, the people who have not joined the event will not show up under /{eventid}/attending, you need to add in the users who are returned in /{eventid}/not_replied. The not_replied set seems to be a special set in the GraphAPI.. and if you look at the docs, there is a mention of only people who have joined the event.

Related

Is it possible (again) to collect event data from Facebook API?

I run an event platform and am looking for a way to retrieve event data (name, date, location, description, etc.) from different events (festivals) on Facebook.
We were working on a connection when the Cambridge Analytica thing happened. Since then my developers have not found a new way to retrieve info, but I'm a bit skeptical.
As of now, it is not possible to get Page Events (which you want to get, i assume):
This is a restricted edge. You cannot request access at this time.
Source: https://developers.facebook.com/docs/graph-api/reference/page/events/

Facebook Graph API | Marketing Insights - Count Shares and Likes, Haha, Love...Etc for an AD

Is it possible to get Share Count as well the actions count for likes, ahah, dislike etc via the Facebook API / Marketing insights?
So far I'm able to get this data for posts(which are related to ads if promoted), but this is a lifetime metric I can't have the numbers in a daily basis, unless I calculate it by doing the difference once I have the data.
Also, I would never now, if the likes are being made by someone who saw my post somewhere because its promoted, or if that person went directly to my page.
Is there any way to achieve this results?
If you look at the actions field in insights, you should see a field called post_reaction which is the total number of reactions for your ad in the requested timeframe.
To get a daily breakdown, use time_increment=1 and time_range to specify the date range.
I don't believe we provide breakdowns on the different reaction types however.
Docs for parameters:
https://developers.facebook.com/docs/marketing-api/insights/parameters/v2.9

Is there any way to get a list of users for a custom audience?

Getting other details is easy, but there doesn't seem to be any API accessible way to get a list of users (or even approximate users) for the audience. You can add them, and delete them (?!) but not enumerate all the users in the list.
Is that truly the case, or am I missing something?
According to the documentation here: https://developers.facebook.com/docs/reference/ads-api/custom-audience-targeting/ you should be able to see an approximate count.
There is no way to get the users back from the custom audience list by design.
For the audiences you never upload raw contact data. You always have to hash it via SHA256 and send the feed to Facebook that way. Since you have not provided the actual contact information like email, phone number facebook won't give those back to you it would be an information breach in a way.
If what you are asking is whether you can retrieve back the hashes that you have sent, I have not been able to find a way it on the API so I assume they think that you already have that list since you uploaded it in the first place.
https://developers.facebook.com/docs/marketing-api/audiences-api/

Facebook APIs using checkins as an entry to raffle

I've been exploring ways that it might be possible to promote the business of a friend of mine. One of these ways is by encouraging users to check in to his business, the incentive for this being that they go into the draw to win some kind of prize.
I've been trying to find if the code for this already exists but I might be looking in the wrong places. If it doesn't what would be the best way to do it using the graph APIs.
Thanks.
You can use Facebook app to check-in to your page/business.
All page check-ins can be fetched using following request by your code
https://graph.facebook.com/PAGE_ID/checkins?access_token=PAGE_ACCESS_TOKEN
If you want to get only specific time period check-ins use since and until params in query.
You have to parse the json response and store in an array and randomly select the winner.
you can contact the winner using their facebook id and send them a message.
You will have to write the code yourself, but it would essentially work like this:
Get the user to allow access to the "Raffle" application and get their email address and permissions to look at their check-ins. Email is required to contact the winner.
Use a scheduled script (cronjob) to periodically check if the user has checked-in anywhere (in particular, the business you want to promote).
Award a raffle ticket for each unique check-in within a 24 hour period.
Hold a draw between all the users who checked in on that day or week and award the prize to someone randomly.
Pretty simple flow, but complex code.

Adwords Impressions, Clicks and Cost, how to get these?

I'm developer for marketing company and I need some help with facebook ads. I've been trying to find method for getting data AUTOMATICALLY from facebook campaign that's created by the user.
I'm trying to create script that would get data for server.
So basically I need to get Impressions, Clicks and "Cost of clicks" from each day from facebook-ad-campaigns just by having user login data (username,password) and maybe the id-number of campaign being targeted.
Also if possible I'd like to know how you can shut down campaign(when cost of clicks is greater than budged used).
Are these operations possible? Can I use PHP/FQL for it? Can I get these via Url? If I need to use FQL, what tables I need to fetch data? Anything that can be performed without manually logging to facebook? If so, could I get some example code to do it for me? If it has something to do with Access Tokens, what kind of access rights do I need to grant for it?
Can it be possible to ask more questions in one question than you just did? Wow.
Answers are in order of them asked above. But I will not be answering any followup questions in this thread.
For most of your information can be found at: http://developers.facebook.com/docs/reference/ads-api/
In your code, set a trigger when it has reached that value in the adstatistics, then use the Ads API to shut it down using the pause feature
Yes, use the Ads API. http://developers.facebook.com/docs/reference/ads-api/
For some parts of it you can, for other parts you'll use Graph API object.
Yes, that's how the graph works.
Tables are listed in the documentation at http://developers.facebook.com/docs/reference/ads-api/
Nope.
Yep, example codes are there.
Yes, it sure does.
see https://developers.facebook.com/docs/reference/api/permissions