All Projects → eisenjulian → messenger-bot-nlp

eisenjulian / messenger-bot-nlp

Licence: MIT license
A Facebook Messenger bot sample integrated with built-in NLP from wit.ai

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to messenger-bot-nlp

Messenger Platform Postman Collection
A delicious Postman collection for all your Messenger Platform needs.
Stars: ✭ 150 (+1053.85%)
Mutual labels:  messenger-bot, messenger-platform
Chatblocks
Declarative Messenger chatbot framework
Stars: ✭ 48 (+269.23%)
Mutual labels:  messenger-bot, messenger-platform
Laravel Fb Messenger
Laravel Facebook Messenger Provider
Stars: ✭ 85 (+553.85%)
Mutual labels:  messenger-bot, messenger-platform
React Messenger Customer Chat
React component for messenger customer chat plugin
Stars: ✭ 221 (+1600%)
Mutual labels:  messenger-bot, messenger-platform
messenger-bot
A Node bot server for the Facebook Messenger Platform
Stars: ✭ 23 (+76.92%)
Mutual labels:  messenger-bot, messenger-platform
Messenger Bot Rails
Ruby on Rails Gem for the Facebook Messenger Bot Platform
Stars: ✭ 64 (+392.31%)
Mutual labels:  messenger-bot
Tock
Tock - the open source conversational AI toolkit
Stars: ✭ 175 (+1246.15%)
Mutual labels:  messenger-bot
Laravel Messenger Bot Management
😄 Messenger bot Q&A management with Laravel
Stars: ✭ 52 (+300%)
Mutual labels:  messenger-bot
Aww-Bot
Messenger chatbot programmed to send images of cute cats and dogs pictures
Stars: ✭ 19 (+46.15%)
Mutual labels:  messenger-bot
Ptt Alertor
📢 Ptt 文章通知機器人!Notify Ptt Article in Realtime
Stars: ✭ 150 (+1053.85%)
Mutual labels:  messenger-bot
Messengerbot
Facebook Messenger Bot for AlexU CSED'18
Stars: ✭ 12 (-7.69%)
Mutual labels:  messenger-bot
Jbot
Make Slack and Facebook Bots in Java.
Stars: ✭ 1,148 (+8730.77%)
Mutual labels:  messenger-bot
Messengerbot
Python client for Facebook Messenger Platform Bot
Stars: ✭ 140 (+976.92%)
Mutual labels:  messenger-bot
botnaut
Chatbot Framework for Facebook Messenger platform
Stars: ✭ 13 (+0%)
Mutual labels:  messenger-platform
Swiftybot
How to create a Telegram, Facebook Messenger, and Google Assistant bot with Swift using Vapor on Ubuntu / macOS.
Stars: ✭ 247 (+1800%)
Mutual labels:  messenger-bot
Chatbots
Chatbots build with Intelligo Framework.
Stars: ✭ 119 (+815.38%)
Mutual labels:  messenger-bot
Botvid 19
Messenger Bot that scrapes for COVID-19 data and periodically updates subscribers via Facebook Messages. Created using Python/Flask, MYSQL, HTML, Heroku
Stars: ✭ 34 (+161.54%)
Mutual labels:  messenger-bot
php-chatfuel-class
A PHP class to generate JSON output for your chatbot (build with Chatfuel)
Stars: ✭ 22 (+69.23%)
Mutual labels:  messenger-bot
MessengerBot-WebAPI
Asp.net WebAPI Template of Facebook Messenger Bot
Stars: ✭ 22 (+69.23%)
Mutual labels:  messenger-bot
bkit
build a messenger bot using HTML
Stars: ✭ 36 (+176.92%)
Mutual labels:  messenger-bot

Messenger Bot with built-in NLP

A Facebook Messenger bot sample integrated with built-in NLP from wit.ai fully deployable to Heroku

Before we start

Set-up

  • Fork this repository. Then when deploying to Heroku the code will stay synced with whatever changes you make on your copy
  • Create a Facebook page that will be the face of your bot
  • Create a wit.ai app that will be its brain
  • Take note of your wit.ai Server Access Token. You can get it from the settings page
  • Now we are ready to configure your Facebook App. Open it at https://developers.facebook.com/apps/<APP_ID> and go to the Messenger tab
    • In the Token Generation section select your page and generate a token. This will allow our server to listen and reply to conversations
    • Find the Webhooks section and subscribe to all events. Then find and select your page and subscribe
    • In the Built-In NLP section, select your page, choose the Custom model, add you wit.ai Server Access Token previously retrieved and Save
  • You are ready to go! Tap deploy button and you will need to enter the App ID and App Secret from you Facebook App that can be found in the Dasboard tab. You will also need a Verification Token, but that can be any string you want.

Deploy

  • One last thing, now that you have a node.js webserver in production we need to tell Facebook where to forward all incoming messages to your bot. Go to the Webhooks section on your Facebook app and click on Edit Subscription. You can get the Callbacck URL from Heroku in the Open App button, it should be https://<APP_ID>.herokuapp.com/webhook. The Verify Token is the one you entered in the previous step
  • Talk to your page, it should reply
  • Now it's your turn to give it some personality.

Adding NLP

A 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.

  • Keywords are entities from a finite set of posibilites such as countries or vegetables
  • Free-text are specific parts of the sentence that we want to extract, like the message content to send, or the text snippet to translate
  • Free-text & keywords is of course a mixture of the last two, where we cannot anticipate all the possible values
  • Traits are labels that affect the whole sentence, not just a single part, like the sentiment or the intent of the phrase

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.

Running locally

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.

Review process

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!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].