Purpose of this integration is to receive a message on Slack for new Notifications and Messages received on Facebook.
-
Obtaining Slack Incoming Webhook url:
- Go to
https://<your-team-name>.slack.com/services/new/incoming-webhook
. - Choose
@slackbot
as channel and add Incoming Webhook Integration. - Copy the Webhook URL and enter it as
slack_url
in config variables at deployment stage. - Customize the webhook with your favorite name and icon (Facebook Favicon included) and save.
- Go to
-
Obtaining Facebook App ID and App Secret:
- Go to Facebook Developers and register.
- Follow instructions and create a new web app.
- On you app's page, Copy the App ID and enter it as
app_id
in config variables at deployment stage. - Copy the App Secret and enter it as
app_secret
in config variables at deployment stage.
-
Obtaining Facebook User Access Token:
- Go to Facebook Graph Explorer Tool.
- Select your fb app in application dropdown and click 'get token' > 'get access token'.
- Select
user_about_me
permission and from extended permissions selectmanage_notifications
,read_mailbox
,read_stream
- Click
get access token
and enter the token generated asaccess_token
in config variables at deployment stage.
-
Deploying:
-
Set config variables
slack_url
app_id
app_secret
access_token
in the settings tab of your app. -
Fork and clone this repository to you local.
-
Add heroku remote to your local repo using the deploy instructions in the deploy tab of your heroku app.
-
Push to remote using command:
git push heroku master
-
Check
heroku ps
to confirm that you web is working otherwise run command to start your app:heroku ps:scale web=1
-
Keeping Active (for heroku deploys):
- Heroku tends to kill the dyno if the app route is inactive for 30mins (may change). Hence, we will use one of the ping services available online. I chose HerokuPing.
- Just submit your heroku app url there and it will ping your app every 10mins, firing up the facebook checking functions.
After above steps, Facebook-Slack-Integration will check new fb messages every time the app is pinged by the service you chose while checking new fb notifications every 6th time to keep you updated at your chosen slack channel for the webhook.
You will need to re-generate your facebook access token (step 3) every 2 months. This is a restriction made by fb api for security reasons.
Having trouble with Facebook-Slack-Integration? Create an issue in the repository GitHub Repo.