Facebook realtime callback endpoint
Facebook will call this endpoint when there is a change in user’s feed/likes or if there is a new message for DeCirc page
-
Copy
fbrealtime-apache.confto/etc/apache/sites-availableand enable it -
Put SSL certificates in
/usr/local/sslcert/ -
Check https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps for deploying
-
Facebook will call these url’s:
https://feed.decirc.com/fbrealtimeandhttps://feed.decirc.com/messenger
Setup/Change realtime subscriptions in facebook:
curl -XPOST 'https://graph.facebook.com/732254010188683/subscriptions' -d 'access_token=732254010188683|liUKDnHIHjVmeg2ctKFVutScxqI&callback_url=http%3A//test.decirc.com%3A5000/fbrealtime&object=user&verify_token=8830413dee096b33785d502684a8875f&fields=feed,likes'
Set Greeting Text
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Hi, hope you are doing well! We have got some great new games, music and movies that you may like. What can I get for you?"
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=<page_access_token>"
Explaination:
access_token=appAccessToken&callback_url=callback_server_url_encoded&object=user&verify_token=verify_token&fields=feed,likes
verify_token in the above request is fb_realtime_verify_token value in FBRealtimeCallback/configuration.ini
Test if the server is working:
https://feed.decirc.com/fbrealtime?hub.mode=subscribe&hub.challenge=testing&hub.verify_token=8830413dee096b33785d502684a8875f
Add this url in facebook developer settings for an app
FB Realtime edge for portal user’s likes and feed
- Go to
DeCircapp in FB and clickWebhooks(https://developers.facebook.com/apps/621166884630730/webhooks/) - Enter
Callback URLashttps://feed.decirc.com/fbrealtimeand enterfb_realtime_verify_tokeninFBRealtimeCallback/configuration.iniasVerify Token - Enter
feed, likesinFields - Facebook will verify this and start pushing realtime data
FB Realtime edge for Messenger
- Go to
Social Storeapp in FB and clickWebhooks(https://developers.facebook.com/apps/806491129480662/webhooks/)` - Enter
Callback URLashttps://feed.decirc.com/messengerand enterfb_realtime_verify_tokeninFBRealtimeCallback/configuration.iniasVerify Token - Enter
message_deliveries, messages, messaging_optins, messaging_postbacksinFields - Facebook will verify this and start pushing messages data
Written on March 3, 2014