How to use Webhook Service

How to use Webhook Service

 1) Click the Marketplace tab from the navigation menu on the left at MindBehind Live.

 

2) Select Conversation Urls from Category dropdown list.


3) After clicking the Select button, a popup will be opened. Select your company click "Next".


4) You need to enter your webhook endpoint urls that you want to receive the
requests from MindBehind side for the specific events, like starting, ending and
voting of the conversation.

 

5) Set the url values as in the image above and click the Set Configurations button
which will save your urls. If you want to change your existing endpoint addresses you
can basically open the same popup and overwrite the endpoint you want to change.


Note: Example urls (webhook.site) are used for the testing purposes.


6) After you set related hook endpoints, you will start to receive requests from
MindBehind for the fields you set before, i.e. If you set an endpoint url for only ending
conversations, you will receive requests to that endpoint when a conversation has
been ended.


7) Request object field and types you will receive as JSON object;
  1. {
     conversationId: string;
     outerConversationID?: string;
     channelID?: string;
     companyID?: string;
     messages: Messages;
     startDate: Date;
     endDate: Date;
     lastMessageDate: Date;
     tags?: string;
     forwardDate?: Date;
     channelClientID?: string;
     clientID?: string;
     botInfo?: ConversationBot;
     agentInfo?: ConversationAgent;

     isHandedOver?: boolean;
     isInternalHandedOver?: boolean;
     historyList?: ConversationHistory;
     channelType?: ChannelType;
     rating?: number;
     ratingComment?: string;

     isEnded: boolean;
     isNewClient: boolean;
     firstAssignedTime: Date;
     firstResponse: Date;
     clientFirstResponse: Date;
     departmentID: string;
     botParams: object; 

     clientName?: string;
     clientSurname?: string;
     clientEmail?: string;
     clientPhone?: string;
     clientTags?: string[];
     clientKeyValueProperties?: ClientKeyValueProperties;

     eventType: string;
    }
  2. WebhookEventTypes {
     "START_CONVERSATION",
     "END_CONVERSATION",
     "VOTE_CONVERSATION"
    }
  3. Messages {
     oid: string;
     content: string;
     messageType: ConversationMessageType;
     messageDate: Date;
     sendBy: ConversationMessageSender;
     outerMessageID: string;
     botInfo: ConversationBot;
     agentInfo: ConversationAgent;
     debugInfo: string;
     commandType: ConversationCommandType;
     commandPayload: string;
     metadata: string;
    }
  4. ConversationBot {
     botID: string;
     versionID: string;
     moduleID: string;
     forwardDate: Date;
    }
  5. ConversationAgent {
     agentID: string;
     forwardDate: Date;
     departmentID: string;
    }
  6. ConversationHistory {
     _id: string;
     isAgent: boolean;
     versionID: string;
     moduleID: string;
     forwardDate: Date;
     departmentID: string;
    }
  7. ChannelType {
     "SUITE",
     "FACEBOOK",
     "MICROWEBCHAT",
     "FRESHCHAT",
     "SMOOCH",
     "MINDBEHIND",
     "DIALOG360",
     "MBWEBCHAT",
     "DIALOG360_SANDBOX",
     "ZOHO",
     "ZENDESK",
     "HEALTH",
     "DIALOGFLOW",
     "JIVOCHAT",
     "WHATSAPP",
     "INSTAGRAM",
     "APPLEIMESSAGE",
     "INFOBIP",
     "BIP"
    }
  8. ClientKeyValueProperties {
     key: string;
     value: string;
    }
Example Webhook Request;

  1. {
      "conversationId": "61f2b3528ca26a3f0e5b747d",
      "channelID": "60a66dd9a8d4fc06e95b67ad",
      "companyID": "56262d25-7df0-4a0f-ade7-4c90b67e8383",
      "messages": [
        {
          "oid": "97e26998-1bbe-4354-88c3-5191196c08ca",
          "content": "{\"BROWSER_TYPE\":\"Google Chrome\",\"CHAT_URL\":\"https://dev.mindbehind.com/chatbot-test?channelId=60a66dd9a8d4fc06e95b67ad\"}",
          "messageType": "CONNECT",
          "messageDate": "2022-01-27T14:59:30.126Z",
          "sendBy": "CLIENT",
          "outerMessageID": "9b5c61f4-ddb0-474e-aba7-8d407286cfe2",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa"
          }
        },
        {
          "oid": "0873f871-55fd-4942-9c1d-b5d7c6f278ba",
          "content": "Merhaba ismim Juju, size nasıl yardımcı olabilirim?",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:30.416Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "2"
          },
          "metadata": "\"\""
        },
        {
          "oid": "cc63d6a2-b515-407f-b3a9-4b31e7a7324a",
          "content": "Sana yardımcı olabileceğim herhangi bir konu var mı?",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:35.703Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "4"
          },
          "metadata": "\"\""
        },
        {
          "oid": "6677175c-7e5d-4d17-bd84-f52068535e8f",
          "content": "https://srnfile.s3-eu-west-1.amazonaws.com/5e0ba8dc-8f94-4f9e-ba4d-fcc2728243ff/16427kahvecesitlericover.jpg",
          "messageType": "IMAGE",
          "messageDate": "2022-01-27T14:59:35.836Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "13"
          },
          "metadata": "\"\""
        },
        {
          "oid": "90c0e91e-9efd-40cb-80e6-bae774bb5a30",
          "content": "{\"buttons\":[{\"type\":\"T\",\"text\":\"A\",\"action\":\"A\"},{\"type\":\"T\",\"text\":\"B\",\"action\":\"B\"}],\"title\":\"\",\"subtitle\":\"\",\"text\":\"Please select.\",\"image\":\"\"}",
          "messageType": "QUICKREPLY",
          "messageDate": "2022-01-27T14:59:38.051Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "6"
          }
        },
        {
          "oid": "4b24f5de-0926-49dd-899b-dfb354d8cb4e",
          "content": "A",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:39.320Z",
          "sendBy": "CLIENT",
          "outerMessageID": "790523d8-afbb-47ab-9ab8-040927bef287",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa"
          }
        },
        {
          "oid": "94d62669-a024-4c4a-a2f7-117bd79686b5",
          "content": "A seçiminiz alındı. Teşekkürler.",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:41.606Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "8"
          },
          "metadata": "\"\""
        },
        {
          "oid": "18cdc3d8-440c-4760-bacb-dd4bca43458a",
          "content": "Bizi tercih ettiğiniz için teşekkür ederiz.",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:41.813Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "10"
          },
          "metadata": "\"\""
        },
        {
          "oid": "1056524c-02c6-4b9a-84ae-0625604ea9a5",
          "content": "COMMAND",
          "messageType": "COMMAND",
          "messageDate": "2022-01-27T14:59:42.022Z",
          "sendBy": "BOT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
            "moduleID": "12"
          },
          "commandType": "INTERNAL_HANDOVER",
          "commandPayload": "{\"departmentID\":\"615307b69c81200011612894\"}",
          "metadata": "\"\""
        },
        {
          "oid": "81b10713-c50d-402f-9f2c-662bc76bd50e",
          "content": "INTERNAL_FORWARD",
          "messageType": "COMMAND",
          "messageDate": "2022-01-27T14:59:42.100Z",
          "sendBy": "AGENT",
          "agentInfo": {
            "agentID": "ed9404ec-b43c-43ca-bcc3-0795b37f6b21",
            "forwardDate": "2022-01-27T14:59:42.100Z",
            "departmentID": "615307b69c81200011612894"
          },
          "commandType": "INTERNAL_FORWARD",
          "commandPayload": "{\"agentID\":\"ed9404ec-b43c-43ca-bcc3-0795b37f6b21\",\"departmentID\":\"615307b69c81200011612894\"}"
        },
        {
          "oid": "e8d2c75c-8a65-4108-8b57-563ca33d298c",
          "content": "Merhaba yeni departmanına hoşgeldiniz.",
          "messageType": "TEXT",
          "messageDate": "2022-01-27T14:59:42.119Z",
          "sendBy": "AGENT",
          "botInfo": {
            "botID": "c564386e-596f-4d73-a975-758b24b48f29",
            "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa"
          }
        },
        {
          "oid": "33f3b2d3-c24a-4bf8-ac8e-9062f5b924f0",
          "content": "CLOSE",
          "messageType": "ENDOFCONVERSATION",
          "messageDate": "2022-01-27T15:00:23.839Z",
          "sendBy": "CLIENT",
          "outerMessageID": "d1a264a9-6805-4430-8192-7f7f9dd46fcf",
          "agentInfo": {
            "agentID": "ed9404ec-b43c-43ca-bcc3-0795b37f6b21",
            "departmentID": "615307b69c81200011612894"
          }
        }
      ],
      "startDate": "2022-01-27T14:59:30.143Z",
      "endDate": "2022-01-27T15:00:23.888Z",
      "lastMessageDate": "2022-01-27T14:59:30.143Z",
      "tags": [
        "kahve"
      ],
      "channelClientID": "1f65df0e-0e0f-48e6-af31-34678d6405b9",
      "clientID": "61e353e14b5d6f564e51fe2f",
      "botInfo": {
        "botID": "c564386e-596f-4d73-a975-758b24b48f29",
        "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa"
      },
      "agentInfo": {
        "agentID": "ed9404ec-b43c-43ca-bcc3-0795b37f6b21",
        "forwardDate": "2022-01-27T14:59:42.129Z",
        "departmentID": "615307b69c81200011612894"
      },
      "isInternalHandedOver": true,
      "historyList": [
        {
          "_id": "c564386e-596f-4d73-a975-758b24b48f29",
          "isAgent": false,
          "versionID": "23fae78d-22ee-46aa-afd9-f2a16a5013aa",
          "forwardDate": "2022-01-27T14:59:30.143Z"
        },
        {
          "_id": "ed9404ec-b43c-43ca-bcc3-0795b37f6b21",
          "isAgent": true,
          "forwardDate": "2022-01-27T14:59:42.129Z",
          "departmentID": "615307b69c81200011612894"
        }
      ], 
    "botParams": { "Name": "Mindbehind", "Phone": "5xxxxxxxxx", "Mail": "example@mindbehind.com" }
       "channelType": "MBWEBCHAT",
      "rating": 10,
      "isEnded": true,
      "clientFirstResponse": "2022-01-27T14:59:39.342Z",
      "departmentID": "615307b69c81200011612894",
      "clientTags": [],
      "clientKeyValueProperties": [],
      "eventType": "END_CONVERSATION"
    }


    • Related Articles

    • How to Use Integration Action

      Action usage Use the integration action when you want to call an HTTP integration endpoint to achieve some custom business needs. You can process the parameters saved during the life cycle of the assistant, and either only store them out in some ...
    • How to Use Wait for Action

      Action usage Use the wait for action when you want to control the assistant behavior from your outside system. The story begins by drag and dropping (Or simply clicking on) the Wait for action from the Actions menu on the left side of your assistant ...
    • How to Use the Integration Action for Non-developers

      Why do we need the Integration Action? Virtual assistants are there to provide information and guidance for the user. The knowledge of the assistants is, however, limited to the conversation itself. When virtual assistants are incapable of providing ...
    • How to Use Logic Action

      Action usage Logic action is used when there is a conditional flow depending on the value of parameters in the current state. And logic action can contain multiple conditional units but always will use the connection of the last conditional unit ...
    • How to Use Language Detection

      What is Language Detection Module for? This module is created for detecting the language of user input. It is possible to detect language and send the user to different flows according to the language of the input. How to use Language Detection ...