Facebot is a Slack bot for facebook messenger integration. It allows you to link slack channels to facebook messenger, and communicate to them through slack.
You can immediately deploy and start using the bot by clicking the button below:
You will need to enter your slack bot API key, facebook details and slack username, and it will begin running on a free heroku instance.
You can download the package from npm with:
npm install facebot
Facebot requires the following environment variables:Variable Description
BOT_API_KEYThe slack bot API key, for the bot user you want to run facebot
BOT_NAMEThe name of your slack bot
AUTHORISED_USERNAMEThe slack username for the authorised user. The authorised user should be the owner of the Facebook account. Only the authorised user can interact with Facebot (link channels etc).
FACEBOOK_EMAILEmail address for the Facebook account you want to use
FACEBOOK_PASSWORDPassword for the Facebook account you want to use
DATABASE_URLURL for a postgres or mysql database to save and load data from, see details below for format. This reduces the number of sign in messages you may receive by using existing cookies and tokens, and keeps channel links persistent through bot restarts. If this is not set the bot will still function, but you will lose channel links between sessions (if not using file based storage).
DEBUG_MESSAGESFalse by default. Set this to true to receive debug direct messages from Facebot
You can test or run Facebot locally with
You will still need to setup the environment variables described above (without
run_local_storage.js will use the local file system to store the login data and any channel links, this is usually not appropriate when running on a PaaS such as Heroku.
To link a slack channel to a Facebook friend, create a new private channel and invite Facebot. Then send
@facebot chat FriendNameHere to link incoming and outgoing messages.
Pull requests more than welcome!
Some things to keep in mind
This project uses yarn to lock down dependencies, so when adding another dependency remember to update the yarn.lock file
In order to keep the code formatting and style consistent this project uses Prettier to enforce formatting.
Prettier is installed as a dev dependency, and a pre-commit hook is setup to automatically run and prettify staged files just before commiting.