javafacebook-messengerwit.aifacebook-chatbot

Facebook Messenger - ChatBot - wit.ai integration


I have my application running on AWS on tomcat instance with Java code with mongodb database.

I now need to integrate this with Facebook messenger ChatBot and wit.ai.

I am really struggling to get started, some sample code i have found but in different languages.

Can i run this and integrate with my portal running on Tomcat. it should call both Facebook messenger and wit api.

I need to get high level idea as to how to proceed.


Solution

  • First of all think about what your bot should do. What functionality will it provide, which questions will be asked by users and how you would like to respond to that. If you have a general idea about your problem space you can start thinking about the technical challenges.

    Be aware that both the Messenger Platform and wit.ai are completely independent products and they provide an HTTP interface to their service. That means you can use any language you like to interact with these platforms. Your application acts as the middleman to these services.

    Start off establishing an integration with the Messenger Platform so you that you are able to both receive and send messages. For that you have to create a Facebook page which acts as the identity of your product. Users will find you in Messenger by your pages' name. You also need to create a Facebook app where you subscribe to your page and specify the webhook settings so that messages are relayed to your own backend service.

    The documentation for this is really good and I advise you read it carefully. You can find it here. After going through the docs you will have a good understanding of what you can do with the Messenger Platform and which types of messages you can send and receive.

    Once your able to send and receive messages you can start to extract some sense out of them. For this you can use wit.ai, but there are also other services you might consider. E.g Google just released their own NLP platform which provides similar features. See here Also there is api.ai In general you have to send received messages to the service of your liking and get back structured information about what the intent of the user is and what values where extracted. With that information you can act accordingly.

    If you want to stick with wit.ai go through their Getting Started guide and recipes section. That enabled me to use their platform.

    I hope this gives you a general idea about how an integration could work. This is fairly high-level and much of the details (especially on the NLP side) depend on your specific use cases.