Search code examples
facebookfacebook-graph-apiasynchronousfeed

Facebook Post to feed asynchronously


I'm using Facebook graph API to post to Users Friends Feed after some action in my App. Now, my code iterates over the friend list and make a POST call with appropriate message and link in each iteration. This makes the processing very slow as it waits till the Post is successful and then proceeds.

friend_list = graph_get("me/friends") for friend in friend_list: res = graph_post(friend['id']+"/feed",message,link)

What is the standard way to do this and how should we optimize it. Is there any way to make these POST Asynchronous?


Solution

  • You could issue 20 of these at a time with batch requests. Otherwise, you can do them asynchronous the same way you make any other http call in whatever language you are using. Be warned though that posting to a users friends wall in a loop like this is the fastest way to get your app deleted by Facebook for spam.