An open source Facebook Messenger news bot for your Wordpress website To help African news organisations deliver personalized news and engage more effectively via messaging platforms.
- A Facebook Page
- A Facebook App with the Facebook Messenger product
- PHP 7.1+
- Xdebug
- Composer
- A local web-server e.g. Apache
- A publicly accessible URL e.g. ngrok
- A Wordpress instance with the Wordpress REST API
- Run
composer install
- Visit localhost to confirm you see
index.php
- Run
cp .env.example .env
- Edit
.env
- Run
phpunit
- Run
ngrok http 80
to get the publicly accessible URL - Go to your Facebook App
- Click
Webhooks
- Select
Page
from the drop-down - Click
Subscribe to this topic
- Enter the publicly accessible URL of your app and
/webhook.php
- Enter the
FACEBOOK_VERIFY_TOKEN
- Click
Verify and Save
- Visit Facebook Messenger
- Search for your Facebook Page and send it a message
Tests are run with phpunit
Sourcebot is configured to build on CircleCI.
You can run local CircleCI builds with circleci build
using the CircleCI CLI.
Here is the full setup process on Medium
You can deploy Sourcebot to your own web-server or quickly and for free to Heroku.
The latest release of Sourcebot is now supported! Changes include:
- Requires PostgresSQL database, available through add-ons:
- Heroku-Postgresql (deploy default)
- It also requires an instance of Elasticsearch
- Bonsai-Elasticsearch (deploy default)
HEROKU_URL
config var renamed toPUBLIC_URL
to avoid using Heroku's namespaceDATABASE_URL
config var will be set for you to access your database
- A Facebook Page
- A Facebook App with the Facebook Messenger product
- PHP 7.1+
- Composer
- A web-server e.g. Apache
- SSL must be configured
- A Wordpress instance with the Wordpress REST API
Before deploying you probably want to give your bot a nice home page as web/index.php
currently displays this README.md
.
Once you have Sourcebot running on a publicly accessible URL you need to set and verify your Facebook App's Webhook.
- Go to your Facebook App
- Click
Webhooks
- Select
Page
from the drop-down - Click
Subscribe to this topic
- Enter the URL of your app and
/webhook.php
- Enter the
FACEBOOK_VERIFY_TOKEN
- If you are using Heroku then it was autogenerated and you can get it from the
Reveal Config Vars
section of your Heroku app'sSettings
- If you are using Heroku then it was autogenerated and you can get it from the
- Click
Verify and Save
- Visit Facebook Messenger
- Search for your Facebook Page and send it a message
- Go to your Facebook App
- Click
Webhooks
- Select
Page
from the drop-down - Click
Subscribe to this topic
- Enter the URL of your app and
https://YOURAPPNAME.herokuapp.com/
- Visit Facebook Messenger
- Search for your Facebook Page and send it a message
To check Sourcebot can connect to your Wordpress go to /wordpress-api-status.php
Contributions are welcome and follows the straightforward Github pull request process:
- Fork
- Code
- Test
- Submit a pull request
- Facebook Messenger requires SSL/HTTPS to communicate with Sourcebot.
- The quickstart guide is useful for setting up your Facebook Page and Facebook App. You do not need to follow the Node.js instructions.
- Make sure you associate your Facebook App with your Facebook Page in
Settings -> Advanced -> App Page
. - Your Facebook App has to be reviewed for the
pages_messaging
permission. Before it is approved only Administrators, Developers, and Testers on the Facebook App's Roles page can interact with the bot. - You can only have one webhook endpoint setup per Facebook App so you probably want a
development
and aproduction
Facebook App at least. - You can only associate one Facebook App per Facebook Page so you probably want a
development
and aproduction
Facebook Page at least.