Creating Chatbot Using Dialog flow and Google Cloud Functions

One can create natural understanding chatbot by using google cloud functions and dialog flow system that is owned by http://mattermost.com. The steps for creating chatbot are as follows:

  1. The configuration of Google cloud webhook using the Google cloud functions
  2. Setting up of Mattermost webhooks
  3. Setting up of google dialog flow for the chatbot

One needs to use the source code and configure into google cloud console. After logging in, create a project name for your chatbot using create functions link and make the cloud function that will be used to call using http://mattermost.com via outgoing integration which needs to be set up. Later select functions such as a trigger, URL and source code and select inline editor and paste in the index.js and package.json files and then in the function to execute dialog box type mattermosthook. Then click on create an icon.

slack alternative

Further using mattermost documentation (http://mattermost.com) you need to set up outgoing and incoming webhook. For outgoing webhook, you need to put google cloud trigger function URL. In the incoming webhook, you need to set up the channel where the posts have to be posted. Thus, the webhook listening in the Random channel. The final step is to set up the chatbot at dialog flow. You need to sign up for a new account and using console create a new agent. Further, you need to create the intent which can be done through dialog flow. After deciding on the intents you can also save the responses that your bot will send once these intents are triggered. You should always save your progress to avoid losing your data.

The final step is to go to settings and grab the token for client access and save it into your google cloud function. You should note that it might take few minutes for google cloud function to save the bot settings and update the same before you can start working on it.