Skip to content

Files

Latest commit

5830cea · Apr 6, 2016

History

History

hubot

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 6, 2016
Apr 6, 2016

Graph API Webhooks Hubot Sample

This example is a Hubot script that messages a chat room when a Facebook Page post is published using Facebook's 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.

These instructions assume you have already set up Hubot on Heroku or Hubot on another platform.

Setup

  1. Download graph-api-webhooks.coffee.
  2. Add a line to hubot-scripts.json with graph-api-webhooks.
  3. Create a new Facebook application and/or register an Instagram API client.
  4. Using token as the verify_token, set up your Facebook application's Graph API Webhooks subscription using https://<your-subdomain>.herokuapp.com/facebook as the callback URL, and/or your Instagram client's subscription using your https://<your-subdomain>.herokuapp.com/instagram as the callback URL.
  5. Set the Heroku configuration values defined at the top of graph-api-webhooks.coffee before deploying.
    • FACEBOOK_APP_ACCESS_TOKEN - access token for your Facebook app
    • REAL_TIME_ROOM - chat room for Hubot to post in
    • WAIT_MINUTES - number of minutes to wait before retrieving the number of likes on the post
  6. Install the Facebook app on your Facebook Page using the Page subscribed apps endpoint.