|
1 | 1 | # Graph API Webhooks Heroku Sample
|
2 | 2 |
|
3 |
| -This example is a [Hubot](https://hubot.github.com/) script that messages a chat room when a Facebook Page post is published using Facebook's [Graph API Webhooks](https://developers.facebook.com/docs/graph-api/webhooks/). The message includes a link to the Facebook post. The bot will post another message with the number of likes on the post after a configurable number of minutes. |
4 |
| - |
5 |
| -These instructions assume you have already set up [Hubot on Heroku](https://hubot.github.com/docs/deploying/heroku/). |
| 3 | +This is a sample client for [Facebook's Graph API Webhooks](https://developers.facebook.com/docs/graph-api/webhooks/) and [Instagram's Real-time Photo Updates API](https://instagram.com/developer/realtime/), powered by [Node.js on Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs). |
6 | 4 |
|
7 | 5 | ## Setup
|
8 | 6 |
|
9 |
| -1. Download `graph-api-webhooks.coffee`. |
10 |
| -1. Add a line to `hubot-scripts.json` with `graph-api-webhooks`. |
11 |
| -1. Create a new [Facebook application](https://developers.facebook.com/apps) and/or register an [Instagram API client](https://instagram.com/developer/clients/manage/). |
12 |
| -1. Using `token` as the verify_token, set up your Facebook application's [Graph API Webhooks subscription](https://developers.facebook.com/docs/graph-api/webhooks/#setup) using `https://<your-subdomain>.herokuapp.com/facebook` as the callback URL, and/or your Instagram client's [Real-time Photo Updates subscription](https://instagram.com/developer/realtime/) using your `https://<your-subdomain>.herokuapp.com/instagram` as the callback URL. |
13 |
| -1. Set the Heroku configuration values defined at the top of `graph-api-webhooks.coffee` before deploying. |
14 |
| - - `FACEBOOK_APP_ACCESS_TOKEN` - [access token](https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens) for your Facebook app |
15 |
| - - `REAL_TIME_ROOM` - chat room for Hubot to post in |
16 |
| - - `WAIT_MINUTES` - number of minutes to wait before retrieving the number of likes on the post |
17 |
| -1. Install the Facebook app on your Facebook Page using the [Page subscribed apps endpoint](https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps). |
| 7 | +### Heroku |
| 8 | +1. Deploy with this button: [](https://heroku.com/deploy) |
| 9 | +1. Test your deployment with `curl https://<your-subdomain>.herokuapp.com` - you should see "It works!". |
| 10 | + |
| 11 | + |
| 12 | +### Facebook |
| 13 | +1. Create a new [Facebook application](https://developers.facebook.com/apps). |
| 14 | +1. Set up your Facebook application's [Graph API Webhooks subscription](https://developers.facebook.com/docs/graph-api/webhooks/#setup) using `https://<your-subdomain>.herokuapp.com/facebook` as the callback URL and `token` as the verify_token. |
| 15 | + |
| 16 | +### Instagram |
| 17 | +1. Register an [Instagram API client](https://instagram.com/developer/clients/manage/). |
| 18 | +1. Set up your client's [Real-time Photo Updates subscription](https://instagram.com/developer/realtime/) using your `https://<your-subdomain>.herokuapp.com/instagram` as the callback URL and `token` as the verify_token. |
0 commit comments