GitHub Readme.md
A Facebook Messenger bot sample integrated with built-in NLP from wit.ai fully deployable to Heroku
https://<APP_ID>.herokuapp.com/webhook
. The Verify Token is the one you entered in the previous stepA quick overview of wit.ai NLU engine: it transforms a text snippet into a list of entities, both built-in or custom defined. Entities come in 4 flavours. You can check the docs for more info.
In your wit.ai console, create a trait entity called intent. We will use that trait to store the main intentions the bot is expected to recognize, like greetings, help and your bot's particular expertise.
Try to come up with at least 10-20 samples for each intent, and as you type them assign the propper entities to extract. Most importantly, have other people test your bot and use the Inbox to learn from the examples.
Note than when you deply to Heroku a PostgreSQL database will be created that you will use when running locally as well. Do this once:
git clone https://github.com/<USER_ID>/messenger-bot-nlp.git
cd messenger-bot-nlp
# Clone the values in your heroku apps to your local machine
heroku config -s --app <HEROKU_APP_NAME> > .env
npm install
Do this every time to start a new webserver
heroku local web
and to expose the server to the world via ngrok
node_modules/ngrok/bin/ngrok http 3000
This will print a URL of the form https://<SOME_CODE>.ngrok.io/webhook
that you should use to reconfigure your webhook to point to your local machine. When you are done make sure to reverse this to point back to your heroku app.
Once you're happy with your bot you will want to show it to others, sadly you need Facebook's approval before letting your app out in the wild. The good thing is that you'll only need to this once.
First go the App Review and make sure to toggle your app state to Public.
In the Roles section on your app's dashboard you can add as many friends as you want as test users, who will be able to talk to your bot regardless of its approval status.
Finally, in the Messenger section you can create a new submission. You will only need the pages_messaging
permission. Add the relevant details and click on Submit for Review. It should take only a few days to get approved.
Join the Messenger Platform Developer Community to get help with anything Messenger Bot related.
Good luck!