Skip to Content
Previous article Here Next article Here    

 

Building ChatBot


I will use DialogFlow ChatBot for my implementation. Go to https://dialogflow.com/ Sign up for free ( as a Google product you can use your Google Account to sign in ).

ChatBot Framework in general is well documentated you can find a lot of topics talking about this with easy effort.

Some interesting links :

Wikipedia definition

http://www.digitalistmag.com/digital-economy/2017/10/17/making-business-with-chatbot-05433106

https://www.pypestream.com/insights/15-chatbot-use-cases-1/

http://www.businessinsider.com/sc/chatbots-future-customer-service-2016-9?IR=T

https://quickbooks-engineering.intuit.com/the-one-with-the-chatbot-using-api-ai-fb-messenger-c4c80ae9a07e

At first you need to undertsand three things Small TalkIntents and Entities about ChatBot :

  1. Small talk Intents. These intents are the opener or closer of a conversation.
  2. Intents ( or Business Intents  ) are the intentions of the end-user, these intentions or intents are conveyed by the user to your bot.
  3. Entities are metadata or parametres that compose each intent.

For this scenario i will create two intents GET_AGENTS_LIST and GET_AGENT_ITEM. GET_AGENT_ITEM will contain AGENT_ID as an Entity. Small Talk will be expression like Hi/Hello and Bye or Ciao.

Create Agent

From the left menu click Create new agent link

Choose a name for the agent like TEST_CHAT_BOT and click CREATE button

Step by step to create GET_AGENTS_LIST intent

Click Intent link in the left menu to create new intent

Enter GET_AGENTS_LIST in the field name and add few expressions as shown below. Check Use Webhook checkbox and click SAVE button after.

From to left menu clickFulfillement link

Put the XSJS script url, activate ENABLED and add X-CSRF-TOKEN = unsafe ( other wise you get an this error Webhook call failed. Error: 403 Forbidden ) as header param and click SAVE.

Test the Webhook call. Enter an expression of our intent and hit Enter. For more details click SHOW JSON button

{
  "id": "2fd52f6c-db3d-46db-93a2-19455b9375c4",
  "timestamp": "2017-11-28T08:19:10.335Z",
  "lang": "en",
  "result": {
    "source": "agent",
    "resolvedQuery": "Can you show me the agents list ?",
    "action": "",
    "actionIncomplete": false,
    "parameters": {},
    "contexts": [],
    "metadata": {
      "intentId": "12d39108-21bb-47d8-b465-bd75d754ccf5",
      "webhookUsed": "true",
      "webhookForSlotFillingUsed": "false",
      "webhookResponseTime": 1798,
      "intentName": "GET_AGENTS_LIST"
    },
    "fulfillment": {
      "speech": "Agents List:  FIRST_NAME7464LAST_NAME4174 FIRST_NAME2144LAST_NAME2099 FIRST_NAME6175LAST_NAME4180 FIRST_NAME0316LAST_NAME4742 FIRST_NAME5773LAST_NAME1122 FIRST_NAME3213LAST_NAME2971 FIRST_NAME9376LAST_NAME1463 FIRST_NAME7641LAST_NAME4544 FIRST_NAME1913LAST_NAME2868 FIRST_NAME1021LAST_NAME9984",
      "source": "source-of-the-response",
      "displayText": "Agents List:  FIRST_NAME7464LAST_NAME4174 FIRST_NAME2144LAST_NAME2099 FIRST_NAME6175LAST_NAME4180 FIRST_NAME0316LAST_NAME4742 FIRST_NAME5773LAST_NAME1122 FIRST_NAME3213LAST_NAME2971 FIRST_NAME9376LAST_NAME1463 FIRST_NAME7641LAST_NAME4544 FIRST_NAME1913LAST_NAME2868 FIRST_NAME1021LAST_NAME9984",
      "messages": [
        {
          "type": 0,
          "speech": "Agents List:  FIRST_NAME7464LAST_NAME4174 FIRST_NAME2144LAST_NAME2099 FIRST_NAME6175LAST_NAME4180 FIRST_NAME0316LAST_NAME4742 FIRST_NAME5773LAST_NAME1122 FIRST_NAME3213LAST_NAME2971 FIRST_NAME9376LAST_NAME1463 FIRST_NAME7641LAST_NAME4544 FIRST_NAME1913LAST_NAME2868 FIRST_NAME1021LAST_NAME9984"
        }
      ]
    },
    "score": 1
  },
  "status": {
    "code": 200,
    "errorType": "success",
    "webhookTimedOut": false
  },
  "sessionId": "9e01686e-82bc-498f-86e9-f7b6c2e8864b"
}

The Bot is working well in the next post i will integrate it with faceBook Messenger page.

Previous article Here Next article Here    
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply