Developing Chat Bot using Wit.aI - node.js

I am planning to develop a chatbot using Wit.ai for Android and iOS. I want to have a server where I have the Bot engine. The Bot Engine has several components like Exported application from Wit.ai, calls to weather API, date API etc. When the user sends a message, it is sent to the Wit and it returns back a response. For example, when the user says, "What's the weather in New York, the message is forwarded to Wit which further calls weather API to fetch weather and returns it back to the bot. Bot in turn forwards to app which acts as the presentation layer."
I am planning to use the following to achieve the above:
Heroku to act as the server.
Wit.ai as the NLP
Planning to integrate app with messenger
Since I am new to this kind of programming and architecting, my questions are very basic. Please bear with that. I have the following questions:
Can I have a program uploaded on Heroku which talks to Wit.ai and other APIs? If yes, can someone show a detailed tutorial to call Heroku from app, how to make a call from Heroku to other APIs?
I was advised by some to use Firebase which is Baas. Can I achieve more using that?
With regards,
Suresh

We use the heroku to getting the https url,and if we got that ,we can set up webhook url in developer.facebook.com .
To understand more,follow this tutorial.
Remember when you try to test after you set up all,u need to test ur own account(means cant test every facebook account yet.)
To be public ur messenger bot,u need to wait 5 business days at least.

Related

Azure Bot Creation with Natural Language understanding(LUIS)

I am facing issues while building a Voice bot using nodejs in Microsoft Azure, Currently i have made some research and built a sample chatbot which works fine using nodejs.
I have tried MS portals for voice bot integration and unable to take it forward, need guidance and suggestions.
My idea is getting a number from Twilio, then put my azure bot's end point URL in the twilio number.
Once my twilio gets an incoming call it will route the request to the Azure bot which will respond with a greeting and ask for few inputs, then the recorded voice should be passed to the LUIS app for Natural Language understanding and give the required text which will be further handled by the Azure bot.
I am not sure whether this is good solution, please suggest
I am not able to see any sample code for nodejs. Steps for integration and a basic sample code is what i need as a basic to start with, Your inputs/suggestions on this is highly appreciated.
Using the Bot Framework SDK for Node.js, you can specify text to be spoken by your bot on a speech-enabled channel in either of the following ways:
Set the IMessage.speak property and send the message using the session.send() method
Send the message using the session.say() method (passing parameters that specify display text, speech text, and options)
Send the message using a built-in prompt (specifying options speak and retrySpeak).
Feel free to review the following documentation provided and sample code for more details.
Update
Also check out Connect a bot to Twilio.

Chatbot handover from custom website to Zendesk Message using nodejs

I am currently setting up a chatbot with dialogflow framework. My flow looks like this:
Chat interface- Integration Webhook (Node JS) - Dialogflow
I want the dialogflow to be replaced with zendesk message application when the user says something like 'Talk to live agent'. This facility is already available with FB messenger:
https://chat.zendesk.com/hc/en-us/articles/360001649667-Setting-up-bot-handover-using-Facebook-Messenger-handover-protocol
I am unable to find a way to start a zendesk chat from my integration webhook (node js). It will be helpful for me if anyone knows how to achieve this. Thanks in advance!
You might want to take a look at this sample: https://github.com/dialogflow/agent-human-handoff-nodejs
Even though the handoff is to a live person, you could replace that logic to handoff to another API.

How to create a chatbot with facebook messenger like templates

I'm trying to create a chatbot for use in a chat app I've created. I basically need the chatbot to send me replies that have message templates like in facebook messenger. For example, If I type in "what's the weather like", I want my chatbot's reply to look like facebook's media template, linked here: Media Template
Does anyone have any tutorials or links I can follow?
Thank you in advance.
Cheers!
Usavaully work flow of chat application as follows,
Message providers(Facebook, twitter,slack etc..) receives messages from user
Message is sent to the configured endpoint(your webserver) according to the settings provided in the face book developer page reference
In the webserver you classify the intent prepares the response according to the request and sends the responses back.
So in the 3rd point web server you give responses based on the platform you are responding to reference, since in your case it's your own platform you need to design your own UI based on the response format or you can use some predefined html templates.
I hope answer gave some direction to work on.

How to integrate api.ai bot with any booking site to book/order something?

I've made a chatbot who can talk to people and make a normal conversation. I want to develop that chatbot so that user is able to, say order a pizza from Dominoz.com or Book a ticket on expedia or add something to cart in ebay.
I've made the bot using Google's Api.Ai (diagflow). How can I integrate it with any site performing some kind of transaction. Answer with an example booking/ordering site would be highly appreciated.
Just for additional info: I think it is possible by that webhook option in fulfillment section. But how exactly? How to implement it?
You should check if there are APIs available for ordering/booking through Expedia/eBay. Dominos have exposed their APIs for ordering purposes. Following is the link for bot ordering pizza & node-dominos-api
https://hellotars.com/bot-examples/featured/pizza-ordering-chatbot/
http://riaevangelist.github.io/node-dominos-pizza-api/
https://www.youtube.com/watch?v=F68HtCtJbGA
Webhook in Dialogflow is something where your actual logic lies. You can write it in any language you're confident of & host it somewhere for Dialogflow to communicate with it. There are 2 API references v1 & v2. Your web service receives a POST request from Dialogflow. Your request/response to/from webhook should include mandatory fields mentioned at following links:
https://dialogflow.com/docs/fulfillment
https://dialogflow.com/docs/reference/agent/query

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

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?
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:
Library to handle FB Messenger chatting
Wit.ai library to pass the user input "to stories and get result"
You can integrate Wit to any messaging API. Using the Messenger Send/Receive API for example, you will be able to get and receive messages from/to Messenger users. Wit.ai can then parse the messages and predict the next response.
Here is an example in Node js: https://github.com/wit-ai/node-wit/blob/master/examples/messenger.js
I reviewed the latest updates on wit.ai. It seems that Wit.ai does not have an in-built integration with Facebook Messenger. That is, you can't plug it into Facebook Messenger directly by using the page access tokens etc.
What you'll need to do instead is set up a webhook where Messenger will send callbacks with the details of the user's message. If you want you can enable Facebook's in-built NLP too.
Then inside your webhook, send a call to Wit.ai, and get its output in JSON. Then you must process the JSON and send a reply back to the customer using a Sendmessage API call.
It's a bit long-winded, but if you have this setup, you can potentially use any AI engine in the backend. Including wit.ai or dialogflow.

Resources