Skip to content

Demo of running BotKit for Facebook Messenger on an Express server with MongoDB storage

Notifications You must be signed in to change notification settings

mvaragnat/botkit-messenger-express-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Botkit demo for Messenger, using Express and Mongo

This app is a demo of using Botkit to create a Facebook Messenger bot, using the MongoDB adapter for storage and Express to serve webpages.

The same demo for Slack bots can be found here

Features

  • Serves webpages through standard express routes app/routes/routes.js

  • Uses Monkii as MongoDB driver

  • Stores users ID when a new user clicks on "Send to Messenger"

  • Offers a welcome message when user clicks on "Send to Messenger", replies to Hello, and generally just repeats what you just said

Configuration

  • For local deployment

There are quite a number of steps to set up a Facebook bot

  1. Create a Facebook page. Add Page ID in .env file (rename the .env-demo file)

  2. Create a Facebook app. Add App ID in .env file

  3. Add Messenger to your App, then select the Page, to generate a Page Access token. Add Token in .env file

  4. install localtunnel to your computer, then use this command to make it available for webhooks

lt --subdomain yourappname --port 5000
  1. Add Webhooks to your app

5.1) Choose a verify token, add it to the .env file as well

5.2) Set the app webhook url to https://yourappname.localtunnel.me/webhook

5.3) Restart your server and click verify

  • For Heroku deployment

Add Page ID, App ID, and token as environement variables. Change the webhook route to match your deployed domain name.

You can use MongoLab add-on to add Mongo storage, they have a free tier.

Contributions & style

Contributions are more than welcome! In terms of style, I use standard style with camelcase and brace-style disabled.

Author

Matthieu Varagnat

Licence

Shared under MIT licence

About

Demo of running BotKit for Facebook Messenger on an Express server with MongoDB storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published