Customisation

Custom Channel

The idea behind this custom channel is that you provide your own server to be hooked by messaging services (Telegram, Slack, WeChat, Email, SMS, etc) to send a message. The message then be passed to Qismo by your server to be gather in Qismo dashboard.

To implement this custom channel, here are some steps to follow. First, prepare your custom channel webhook server. It will depends on what service you are integrating with Qismo. But generally, the following scenario will go through within your custom channel.

  1. Your server will receive webhook from other service or your other messaging services.
  2. When your server receive the message, your server need to post the message to Qismo with the following format,

    Header:

    no authorization needed

    URL:

    [POST] /{APP_ID}/custom_channel

    Params:

    'identifier_key'            => 'required', -->  your custom channel identifier key
    'user_id'                   => 'required|email',
    'name'                      => 'required',
    'ignore_agent_availability' => 'boolean|nullable'
    'message'                   => 'required'
    .... 

    other qiscus post comment payload please visit: https://www.qiscus.com/documentation/rest/latest/comment#post-comment

    Response:

    {
        "data": {
            "sdk_user": {
                "id": 3599972,
                "token": "jdalJjh8bic6bJwIolxe",
                "email": "[email protected]",
                "password": "0TjkfP",
                "display_name": "sableng3",
                "avatar_url": "https://d1edrlpyc25xu0.cloudfront.net/kiwari-prod/image/upload/wMWsDZP6ta/1516689726-ic_qiscus_client.png",
                "last_comment_received_id": 4411744
            },
            "choosen_agent": {
                "id": 32,
                "name": "Evan",
                "email": "[email protected]",
                "authentication_token": "Y5K4MVLymtIQP3UNAdA4",
                "created_at": "2018-03-29 08:39:02",
                "updated_at": "2018-04-13 03:33:55",
                "sdk_email": "[email protected]",
                "sdk_key": "d9svU",
                "is_available": false,
                "type": 2,
                "avatar_url": "https://d1edrlpyc25xu0.cloudfront.net/kiwari-prod/image/upload/D1se5xo40I/1516941944-Screen_Shot_2018-01-26_at_11.45.20.png",
                "app_id": 1,
                "is_verified": false,
                "type_as_string": "agent",
                "assigned_rules": []
            },
            "room_id": "807803",
            "message": {
                "message": "bobby",
                "payload": {},
                "timestamp": "2018-06-20T08:08:38Z",
                "type": "text",
                "user": {
                    "avatar_url": "https://d1edrlpyc25xu0.cloudfront.net/kiwari-prod/image/upload/wMWsDZP6ta/1516689726-ic_qiscus_client.png",
                    "user_id": "[email protected]",
                    "username": "sableng3"
                }
            }
        }
    }

image of custom channel pop up

If you notice above, there is a required param called identifier_key. To set it up, go to the integration page and click the Add channel button. A pop up form will appear, just fill in the form.

  1. Channel name: channel name identifier. It will appear on the channel tabs
  2. Identifier Key: This key is used to match the source of request coming from your webhook. This is the required param. You can fill it with anything you want.
  3. Webhook URL: Your custom channel webhook URL

If everything goes well, whenever you send message through your custom messaging service (i.e: Telegram, Slack, etc), you will get the message in Qismo. And you can reply the message directly from Qismo.

For more explanation regarding the flow, please have a look at the following diagram.

diagram flow

We also provide you with an example of custom channel you can try to deploy it on your server. Please have a look at this repository.

Custom Agent Allocation

Qismo allocates available agents by automatically assign less busier agent to a new created chat group. However, you may want to customise this rule by making your own rule. In order to do so, you need to create a webhook that manage how your agents in Qismo is assigned.

image of allocation concept

To connect your webhook with Qismo, you just have to enable custom agent allocation feature in Settings page in Qismo by switching on the toggle button on the top-right of the page and provide the webhook URL in the field provided as depicted in image below. By doing so, Qismo will no longer enforce automatic rule in agent allocation for you. So you are free to do it your own way.

image of custom agent allocation

Qismo will hit your webhook with this payload that you could use in managing agent allocation,

{
  "app_id": "oni-xxxxxxxxx",
  "source": "qiscus",
  "email": "[email protected]",
  "avatar_url": "https:\/\/d1edrlpyc25xu0.cloudfront.net\/kiwari-prod\/image\/upload\/75r6s_jOHa\/1507541871-avatar-mine.png",
  "extras": "{\"a\":\"s\"}",
  "room_id": "123456"
}

In your webhook, it's up to you on how you will assign a newly connected user with your agents. What you will need to do however, is to hit our Assign agent to room id API when you do agent assignments. So for example, if you have a chat with doctor service, you may want to assign your users based on their selected doctors (agents).

Below are a couple of additional documentation and an example on how you could use custom agent allocation.

  1. Custom agent allocation API list document for you to get insight of what APIs you could use in your webhook.
  2. An example of how custom agent allocation has been done. You need to have Salesforce account to try this example.