How does Facebook Messenger connect with Wit.ai Bot Engine?

GarySabo picture GarySabo · May 14, 2016 · Viewed 8.7k times · Source

In Facebook's documentation they refer to wit.ai Bot Engine, but I can't find anywhere online where its explained how to connect the Story that you build in Wit with your Facebook Messenger App?

Answer

GeekSince1982 picture GeekSince1982 · May 15, 2016

Wit.ai needs an input - user input. Sentence, phrase, word - to give you back the analysed results.

So first when you say "your Facebook Messenger app" - you need to make sure you are handling the messenger part by itself: have a code in your language of preference running on the server\your laptop which can receive the text which is sent to the messenger account on Facebook.

When you get that working, you will have to use one of Wit.ai libraries for the code language you are using to pass that phrase you receive from the user chatting through the messenger to Wit.ai "library" which will communicate it "to the wit.ai stories" you have and get the result from them.

For example for Python: