Rate this page:

How to connect custom channel chatbot

Add custom bots to the selected chat. This will allow you to receive messages from your customers directly to the agent’s chat.

Add bots to the selected chat. This will allow you to receive customer messages directly to the agent’s chat from any service including third-party ones. You can interact with APIs using webhooks.

How to connect custom channel

  1. Enter the channel name.
  2. Callback URL – the address to send channel updates such as new messages.
  3. Security Salt is generated automatically when the current channel is created. It participates in the formation of signatures for events. The signature on our side is formed according to the algorithm: The Authorization Header will have this signature: MD5($ {Salt}: $ {token}: $ {EventId}). When creating a channel to the Callback URL, we send a test request with signature: MD5($ {Salt}: $ {token}).
  1. To generate the API token, go to the “Integrations” section, then to the “API Tokens” tab. Click the “Add API Token” button.

After receiving the API token, you can select it in the API token field when creating a custom channel.

  1. Select the queue or function to forward and receive messages.

  2. To get a token for sending events to the Kit, use the login method: POST https://kit-im-{{ACCOUNT_REGION}}.voximplant.com/api/v3/botService/login?domain={{domain}}&access_token={{access_token}}

Add channel_uuid: {{channel_uuid}} to the body of this request. You can get channel_uuid in the settings of your channel in the channel UUID field. The link looks like this: https://kit-im-{{ACCOUNT_REGION}}.voximplant.com/{{CHANNEL_UUID}} After receiving the API token, you can select it in the API token field when creating a custom channel.

With this request, you will receive two new tokens: access_token and refresh_token.

access_token is valid for 15 minutes.

refresh_token is valid for 24 hours.

An example of the data structure that Voximplant Kit expects from an external source:

{
    "client_data": {
        "client_id": "107804195", // REQUIRED! Client ID in the external channel
        "client_phone": "", // Customer phone number
        "client_avatar": "", // Customer avatar link
        "client_display_name": "James Smith" // Сustomer name
        "client_email": "", // Customer Email 
        "client_language": "",
        "utm": {
            "source": "",
            "campaign": "",
            "content": "",
            "medium": "",
            "term": ""
        },
        "page": {
            "url": "",
            "title": ""
        },
        "location": {
            "latitude": 33.1212,
            "longitude": 33.1212,
            "country": "",
            "country_code": "",
            "redion": "",
            "region_code": "",
            "city": "",
            "ip_address": ""
        },
        "device": {
            "type": "",
            "model": "",
            "user_agent": ""
        }
    },
    “event_id”: “123”,
    “event_type”: “send_message”
    “event_data”: {
        "message": {
            “message_id”: “123”,
            "text": "",
            "payload": [
                {
                    "type": "photo | audio | video | document",
                    "file_name": "",
                    "file_url": ""
                }
            ]
        }
    }
}

Use this header: Authorization: Bearer {{access_token}} in the request to send messages to the channel.

  1. Use refresh_token to get a new access_token without specifying additional data: POST https://kit-im-{{ACCOUNT_REGION}}.voximplant.com/api/v3/botService/refreshToken. In the body, specify only the refresh_token:{{refresh_token}} that you received earlier. You will receive two new tokens: access_token and refresh_token.