How to Connect My Own Bot to Comm100 Live Chat Using Webhook

If you’ve built your own bot with a third-party bot provider and want to manage its deployment using Comm100, you can integrate with Comm100 using Webhooks. Once set up, your integrated bot can be deployed over Live chat, Social (Facebook, Twitter), and SMS.

 

Step by Step Instructions

  1. Log in to the Comm100 Control Panel.
  2. From the left navigation menu, go to Bot > Chatbot.
  3. Click the drop-down list and go to the Manage chatbots area.
  4. Click Manage.

    The Chatbots drawer appears.
  5. Click New Chatbot.

    The New Chatbot drawer appears.
  6. Give your bot a Name.
  7. From the Engine drop-down list, select Third Party.
  8. Provide the Webhook target URL.
  9. Click Save.
  10. To modify the bot settings, click the Pencil icon.

    Here you can edit the display Name, Avatar, and Webhook Target URL of the bot you created.
  11. To deploy the bot, assign the newly created bot to a Campaign.

When an event (Chat Joined/Question Asked/Intent Clicked/Location Shared/Form Submitted) occurs in Comm100 Live Chat, we will pass the information to the bot via webhook so that your bot can handle the chat request. Your bot will then have to process the information using its own Bot Engine and send a response to Comm100 so that we can display the bot’s answers to your visitors. The data format type of the request and response is JSON. Please refer to this Third-Party Bot Connection Guide for more detailed info.
 
Below is a sample data we send to your webhook url

{
   "event":0,
   "chatId":"nocn7iKiekCiMG0IrzaEYw",
   "campaignId":3663,
   "question":"Visitor sent a message",
   "visitorInfo":{
      "id":21,
      "pageViews":2,
      "browser":"Google Chrome 72.0.3626.119",
      "chats":8,
      "city":"Vancouver",
      "company":"",
      "country":"Canada",
      "currentBrowsing":"https://ent.comm100.com/livechatfunc/PlanPreview.aspx?codePlanId=3663&siteId=1000298&ssl=1",
      "customFields":[
      ],
      "customVariables":[
      ],
      "department":-1,
      "email":"walidtest@comm100.com",
      "firstVisitTime":"0001-01-02T18:58:13.661673",
      "flashVersion":"",
      "ip":"xx.xx.xxx.234",
      "keywords":"",
      "landingPage":"https://ent.comm100.com/livechatfunc/PlanPreview.aspx?codePlanId=1480&siteId=1000298&ssl=1",
      "language":"en-US",
      "name":"test",
      "operatingSystem":"Windows 10",
      "phone":"",
      "productService":"",
      "ticketId":"",
      "referrerUrl":"https://ent.comm100.com/LiveChat/agentConsole.aspx?siteId=1000298",
      "screenResolution":"1680x1050",
      "searchEngine":"",
      "state":"British Columbia",
      "status":2,
      "timeZone":"GMT  00:00",
      "visitTime":"2019-03-04T09:06:38.4622821Z",
      "visits":7,
      "ssoId":"",
      "chatRequestingPageUrl":"https://ent.comm100.com/livechatfunc/PlanPreview.aspx?codePlanId=xxx&siteId=xxx&ssl=1",
      "segments":[
         339
      ]
   }
}

Here is a Sample JSON response you should send us

 
[
      {
          "type": "text",
          "content": {
              "message": "this is a plain message"
          }
      },
      {
          "type": "text",
          "content": {
              "message": "this is a web link message",
              "link": [{
                  "type": "hypelink",// hypelink or goToIntent.
                  "startPosition": 10,
                  "endPosition": 17,
                  "ifPushPage": true,
                  "url": "www.test.com",
                  "openIn": "currentWindow"// currentWindow, sideWindow or newWindow.
              }]
          }
      },
      {
          "type": "text",
          "content": {
              "message": "this is a go to intent message",
              "link": [{
                  "type": "goToIntent",
                  "startPosition": 10,
                  "endPosition": 17,
                  "intentId": "test-intent-id",
                  "displayText": "test-displayText"
              }]
          }
      },
      {
          "type": "image",
          "content": {
              "description": "description of the image",
              "url": "www.test.com/test-image.jpg"
          }
      },
      {
          "type": "video",
          "content": {
              "url": "www.test.com/test-video.jpg"
          }
      },
      {
          "type": "quickreply",
          "content": {
              "message": "this is a quick reply response",
              "items": [
                  {         
                      "type": "goToIntent",// goToIntent, contactAgent or text.
                      "name": "click to trigger test-intent-name",
                      "intentId": "test-intent-id"
                  },
                  {
                      "type": "contactAgent",
                      "name": "click to contact agent"
                  }
              ]
          }
      },
      {
          "type": "button",
          "content": {
              "message": "this is a button response",
              "items": [
                  {
                      "type": "goToIntent",// goToIntent, hyperlink or webview.
                      "text": "click to trigger test-intent-name",
                      "intentId": "test-intent-id"
                  },
                  {
                      "type": "hyperlink",
                      "text": "click to open this url in web page",
                      "url": "www.test.com",
                      "openIn": "currentWindow"
                  },
                  {
                      "type": "webview",
                      "text": "click to open this url in web view",
                      "url": "www.test.com",
                      "webviewOpenStyle": "full"
                  }
              ]
          }
      },
      {
          "type": "location",
          "content": null
      },
      {
          "type": "form",
          "content": {
              "text": "book ticket",
              "message": "please fill the form below",
              "ifNeedConfirm": true,
              "fields": [
                  {
                      "type": "text",// text, textArea, radio, checkBox, dropDownList or checkBoxList
                      "name": "field-1",
                      "value": "field-value-1",
                      "ifRequired": true,
                      "ifMasked": true
                  },
                  {
                      "type": "dropDownList",
                      "name": "field-2",
                      "value": "field-value-2",
                      "ifRequired": true,
                      "ifMasked": true,
                      "options": [
                          "value": "field-1-value",
                          "value": "field-2-value",
                          "value": "field-3-value"
                      ]
                  }
              ]
          }
      }
  ]