Retrieve number of members of a Facebook group on a certain date - facebook

Does anyone know if there is a way to retrieve the number of members a FB Group had on a certain date?
The usecase is that I want to make a historical graph of member-growth.
A hack could be to check when current members joined, but then you'd miss all members that have joined and left.

Reading some other discussions, it seems like there is no Insight data available for groups, only registered domains, pages and page posts. You won't be able to access historic data directly. You can start measuring now and build up your graph of membership growth by accessing the group/members API regularly (You can use cron to do this in a lightweight way and add the data to your database).

Not so sure with Facebook groups, but with the Facebook App, you can record the access token of the users for later use. Or you can store member id and date they joined in your database. Heroku provide Postgres for that. For the free cronjob, you can use like setCronjob.com to regularly schedule the offline jobs like gathering and calculating the statistic based on the user data that you stored.

Related

How to pull ad insights in bulk using Facebook Graph API?

I am trying to do what I thought would be a very simple task which is to use the Facebook API to retrieve insights about ads, but I'm having so much trouble. I know how to use multiple API calls to retrieve the list of ads, and then retrieve the insights for each ads using an API call for each one.
However, I'm limited at 200 API calls per hour, so this is no good if I wanted to pull all ads from all-time. There is a way to batch call the ad insights using an endpoint like:
act_XXXXXXXXXXXXXXX/ads?fields=insights{cpc, impressions}
But then I am unable to specify the timeframe so it only grabs stats from the past month. Usually I would specify the timeframe with a field of
date_preset=maximum
(or whatever I want the date_preset to be), but in this case if I add it as another field it does not affect the the insights (I presume since they are using those brackets as a special way to pull the bulk insights).
I swear to god if I figure this out I'm releasing it publicly and loudly for free because I think it's ridiculous that this is so roundabout.
Do this: act_XXXXXXXXXXXXXXX/ads?fields=insights.date_preset(maximum){cpc, impressions} This is called a nested query.

Requesting posts of a facebook group

I am looking to create a product that retrieves the posts of a public facebook group (viewable to non-members) and analyse that data based on (from necessary to useful) posts (as strings to be processed), like count, different reaction count and possible geotag data. I am confused by the process of application, as I cannot use the group api without already having an approved app and such - is there a way to retrieve and work on data in python/java/js without actually creating an app, for testing purposes?

Is it possible to query multiple realms at once if a user has admin privileges? Or have a shared realm that multiple users can write to at once?

I’m brand new to realm and have been digging around in the docs all day today. I come from a sql background and am struggling finding out if what I want done can be accomplished with realm.
I’m wanting to create an app that allows normal users to fill out a simple form, and allow admins to access (read only) these forms. Ideally the admin would see all forms created by users listed in a tableview.
After completed the swift tutorial online, I get the impression that only the user who created the realm object can access it…
Is it possible to accomplish what I described above with realm?
There is no way to query multiple Realm files at once currently. In your use case, I recommend you to share one account (created automatically on your application), write multiple users' data to one file. Or sharing one file for multiple users by using Realm's permission change feature, see also https://realm.io/docs/swift/latest/#modifying-permissions

Realtime User friends updates: new friends

Unfortunately the facebook realtime api only informs about something has changed in the friends connection of the app's users.
What do I have to do to identify that UserA has just became friend with UserX?
Currently, anytime I receive a UserA's friends have changed notification from the facebook realtime api, I receive the whole /UserA/friends.json, paging throu the whole result to just identify what has been added since the last time.
While this works, it just feels like a lot of waste in compute-cycles and I like to know if there is a more elegant approach to this...
That's the way it is designed and there is no "solution" for it.
Note that this does not include the actual data values (either from
before or after the update). To obtain those, your app can request
them as normal, subject to the usual privacy restrictions. For data
that you have access to at any time, you may wish to query for that
data immediately following this callback so that it is ready for when
the user returns to your app.
Source: https://developers.facebook.com/docs/reference/api/realtime/
It makes a lot of sense, because Facebook is able to send you ALL UPDATES while not knowing if you have the appropriate permissions to get the new data, so a very easy way to do it in terms of privacy.
If you have a valid user token (in your db) you can retrieve the updated fields via Graph API / FQL and compare it with the data in your database. Without realtime API you need to pull data every x hours/days, which is even more waste of resources.
If you don't have a valid user token you can retrieve the updated fields via Graph API / FQL when the user comes back to your app and compare it with the data in your database. Without realtime API you always need to update/check the data when the user comes back.

Does storing Faceook's social graph in our database violate the terms of service?

We are creating an application that will ask the user for permission to their friends, and then will store their friends_ids in our database, does this violate the terms of service? If so, where can we find this violation cause I couldnt seem to find it.
See the Platform Policy, section II.
You can store the data, but be sure to make it clear to the user. You can't use the data outside of the application or sell it (obviously). For friends list, you should update the list every 24 hours to account for new / removed friends.