I am trying to keep track of my users' facebook friends. I thought that using the webhook is the best solution to this problem.
The webhook is currently working, the request I get from facebook is a json of 2 objects (users), who added each other as friends, so I am able to update them in the database.
For some reason I sometimes get an object of only one user, and I get the other friend in a seperate object. There is no way for me to relate the 2 requests together.
I have read through the whole document but it didn't help https://developers.facebook.com/docs/graph-api/webhooks/v2.5
Is there something that I am doing wrong, or is just using the webhooks for this task is not the right solution? If it's not the solution, should I scrape all my user's facebook friends periodically?
Related
I am trying to build an application where admin users would trough a form insert "events" containing title, description, starttime/endtime and some other fields. At the moment theese users are primarily using facebook to reach out to their users, they would like to be able to move to my app aswell as stay on facebook without too much hassle. I solved the issue of getting the events of facebook by having them all sign up for the graph api with their community/company pages and giving me the access token to fetch data about their events trough a get request to.
https://graph.facebook.com/v15.0/me/events?access_token={their token}
Now my next task at hand was simple i tought simply make a post request to the same api endpoint, but i quickly realized i was not able to do this and well i do not know how to proceed to be fair.
Tried to make a post to the same endpoint but got errors and after searching the documentation found that this was not supported??
I am learning about microservices and I get very confused when it comes to data duplication. From different sources on the internet I get very different opinions on the subject, but the main conclusion that I got is that it depends if it's good on your use case or application.
Now I am struggling because I am trying to make a very simple microservice where I think data duplication is not necessary, but can't seem to think of a good alternative to it.
My Application
I am basically making a Twitter clone to understand the basics of microservices using AWS. To start I have 3 services:
Timeline Service
Post (or tweet) Service
Follow Service
Timeline service
The timeline service should return the timeline of the user that asked it. It should check who the user is, that requests his/her timeline is following, get the 100 most recent posts from those users and return it to the user (that requested his/her timeline)
Posts/tweet Service
When a user is posting a new tweet/post, the post timeline should save the post in the post database to keep track of who posts what.
Follow Service
When a user wants to follow another user the follow service should keep track of that.
If I put it into an image it would look like this:
The problem
My question is about the timeline service. Should the timeline
Have two (in memory) databases that also keep track of who follows who and who posts which tweets to give the user quickly their timeline back
Or should the timeline service call the different services to get that information?
The 'bad' thing from the last option would be that if my posts service is failing and can't send or receive requests, my timeline service also does not work and you create dependency which goes against microservice principles.
Since the last option seems the worst one to me, I would say data duplication is the better option because of response time and to keep the different services from relying on each other.
Can anyone help me to get on the right track with this problem?
I have a working Azure function that receives updates when I use the Graph API Explorer.
All I want to be able to do is submit a UserId to an endpoint and have any Posts they make sent to my WebHooks. We want to do this without the users always having to give permission. Unfortunately, I find the FB docs very confusing as most pages only have partial examples and the majority of the online SO or blog examples are far out of date.
On the FB WebHooks page it says
For example, if you subscribed to the user object's photos field and one of your app's Users posted a Photo, we would send you a POST request that would look something like this
They then say
You can also do this programmatically by using the /{app-id}/subscriptions endpoint for all Webhooks
On the Subscriptions page they have this example
POST /v12.0/{app-id}/subscriptions HTTP/1.1
object=page&callback_url=http%3A%2F%2Fexample.com%2Fcallback%2F&fields=about%2C+picture&include_values=true&verify_token=thisisaverifystring
But then its says this under Permissions
Subscriptions for the object type user will only be valid for users
who have installed the app.
This is not for a mobile app..so I'm confused
The above is to show that I have made all attempts to get this working without first posting here.
Now, I have to ask. Do anyone have experience or a existing code that demonstrates how to Subscribe to a User so that when they Post, I receive Notifications via webhooks?
Or, this this entirely the wrong way to use the Webhooks?
I have an existing app that uses the Facebook API & login that makes posts to the user's wall. For each post I store the id of that post.
What I need to accomplish is to gather like counts of those posts generated by the first app. I'm trying to write a small app that routinely pulls the like count. I've figured out how to get the like count of the post if I use a User Token - via Facebook Login. But since this app will run as a batch and not by a human, I don't want to use a Facebook login page. I could write code that simulates a user logging in but that would be a major ugly hack. I've tried to use an App Token but then the like count is always zero. I've found how to get the like count of a page without the need for a User Token http://www.techrecite.com/get-facebook-likes-count-of-a-page-using-graph-api/ but not a post
Is this even possible? If so how?
I've looked into Facebook API's subscription, but it doesn't seem possible to subscribe to a "like-a-post" event. Although I could be wrong. If so, could someone point me in the correct direction.
Thanks.
is there a way to do this?
Using the me/home json feed, it shows up as a person and just one image of the person they have friended, even if they have friended several.
Is there a way to pull in all the information?
The most efficient way to achieve this is by using the Graph API Real Time Updates, there's no need to pull the home feed. You should be able to subscribe to the "friends" connection of the "user" object you need so your "callback server URL" will be hit by our servers when that user gets new friends (POST Request).
Note that you will only be able to retrieve the user's new friends public information unless they have previously authorized your App.
Please see further documentation at:
https://developers.facebook.com/docs/reference/api/realtime/
Many thanks
Daniel Torvisco - Developer Support Engineer at Facebook