14 Webhooks

Bot Webhook

This Webhook will be triggered when your customer sends a message to your Qiscus Omnichannel Chat.

{
"type": "post_comment_mobile", __ either type "post_comment_mobile" if from client side or       "post_comment_rest" if from REST API
    "payload": {
        "from": {
            "id": 1,
            "email": "user1@gmail.com",
            "name": "User1",
        },
        "room": {
            "id": 1,
            "topic_id": 1,
            "type": "group", # can also be single
            "name": "ini grup",
            "options": {
                "is_resolved": true,
                "source": "wa",
                "is_waiting": "false",
                "channel_details": {
                    "channel_id": 1,
                    "name": "Wa Pertama"
                }
            },
            "participants": [
                {
                    "id": 1,
                    "email": "user1@gmail.com",
                    "username": "User1",
                    "avatar_url": "http:__avatar1.jpg"
                },
                {
                    "id": 2,
                    "email": "user2@gmail.com",
                    "username": "User2",
                    "avatar_url": "http:__avatar2.jpg"
                }
            ]
        },
        "message": {
            "type": "text",
            "text": "ini pesan",
            "payload": {
                # comment type specific payload
            }
        }
    }
}

Custom Agent Allocation Webhook

This webhook will be triggered when your customer sends a message to your Qiscus Omnichannel Chat and has not been assign to the agent yet. Once your customer have at least an agent you will not get this webhook.

{
    "app_id": "oni-bgo2lummmhvzqxbt5",
    "source": "qiscus",
    "name": "sudah",
    "email": "sudah@gmail.com",
    "avatar_url": "https:\\_\\_d1edrlpyc25xu0.cloudfront.net\\_kiwari-prod\\_image\\_upload\\_wMWsDZP6ta\\_1516689726-ic_qiscus_client.png",
    "extras": "{\\"timezone_offset\\":7}",
    "is_resolved": true,
    "latest_service": {
        "id": 244,
        "user_id": 1,
        "room_log_id": 53,
        "app_id": 1,
        "room_id": "1905692",
        "notes": null,
        "resolved_at": "2019-02-04 04:49:47",
        "is_resolved": true,
        "created_at": "2019-02-04 04:49:47",
        "updated_at": "2019-02-04 04:49:47",
        "first_comment_id": "15167003",
        "last_comment_id": "15167015",
        "retrieved_at": "2019-02-04 04:49:47",
        "first_comment_timestamp": null
    },
    "room_id": "1905692",
    "candidate_agent": {
        "id": 22,
        "name": "dewi",
        "email": "dewi@mail.com",
        "authentication_token": "NlASwSIUnAqoTcFjYNBR",
        "created_at": "2019-01-17 06:50:20",
        "updated_at": "2019-01-18 10:12:59",
        "sdk_email": "vsC6x_dewi@mail.com",
        "sdk_key": "NZTGb",
        "is_available": true,
        "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,
        "notifications_room_id": "1692312",
        "bubble_color": "#666666",
        "qismo_key": "43Ondc",
        "direct_login_token": null,
        "type_as_string": "agent",
        "assigned_rules": [
            "fb_messaging",
            "line_messaging",
            "qiscus_messaging",
            "wa_messaging",
            "telegram_messaging"
        ]
    }
}

Custom Button

This webhook helps you to get information about a room chat into your third party systems, such as CRM, Ticketing, Analytics, and many more. This webhook is triggered when admin or supervisor or agent click custom button. Here’s the sample response for this webhook.

{
  "additional_info": [
    {
      "anykey": "any value"
    }
],
  "agent": {
    "email": "qixxxxti@gmail.com",
    "name": "Agent",
    "type": "admin"
  },
  "channel_id": 0004,
  "channel_name": "Channel 1",
  "channel_type": "Qiscus Widget",
  "customer": {
    "avatar": "https:__dxxx_xxxxxx-xxlient.png",
    "name": "Customer Name",
    "user_id": "email_customer@gmail.com"
  },
  "customer_properties": [
    {
      "id": 1,
      "label": "WEBSITE",
      "value": ""
    },
    {
      "id": 2,
      "label": "ADDRESS",
      "value": ""
    },
    {
      "id": 3,
      "label": "COMPANY",
      "value": ""
    }
  ],
  "notes": null,
  "room_id": 0000002,
  "tag": []
}

Mark As Resolved

This webhook helps you to get information about a room chat into your CRM or any other systems. Before you start, you need to register your webhook first. Please follow the example below :

URL :

[POST] https:__omnichannel.qiscus.com_api_v1_app_webhook_mark_as_resolved

Please follow this page to get your AdminToken

CURL Sample:

curl --location -g '{https:__omnichannel.qiscus.com_api_v1_app_webhook_mark_as_resolved' \\
--header 'Authorization: {{AdminToken}}' \\
--header 'Qiscus-App-Id: {{AppCode}}' \\
--form 'webhook_url=""' \\
--form 'is_webhook_enabled=""'

Sample Response:

{
    "data": {
        "id": 123123123,
        "name": "Kipas Omnichannel Tester",
        "app_code": "test-testingomnichannel",
        "secret_key": "3e9f401ea7d65eea1etestingomnichannel",
        "created_at": "2020-03-16 06:53:19",
        "updated_at": "2021-12-29 08:51:31",
        "bot_webhook_url": "https:__testingomnichannel.free.beeceptor.com",
        "is_bot_enabled": true,
        "allocate_agent_webhook_url": "https:__testingomnichannel.free.beeceptor.com",
        "is_allocate_agent_webhook_enabled": true,
        "mark_as_resolved_webhook_url": "https:__omnichannel.qiscus.com",
        "is_mark_as_resolved_webhook_enabled": true,
        "is_mobile_pn_enabled": true,
        "is_active": true,
        "is_sessional": true,
        "is_agent_allocation_enabled": false,
        "is_agent_takeover_enabled": true,
        "is_token_expiring": false,
        "paid_channel_approved": null,
        "use_latest": false
    }
}

This webhook will be triggered when admin or supervisor or agent resolves the conversation. Here’s the sample of webhook responses.

Sample Webhook:

{
  "customer": {
    "additional_info": [
       {
         "anykey": "any value"
       }
    ],
    "avatar": "https:__dxxxxx_xxxxxxxent.png",
    "name": "Customer Name",
    "user_id": "customer@email.com"
  },
  "resolved_by": {
    "email": "qxxxxx@email.com",
    "id": 000000,
    "is_available": false,
    "name": "Agent name",
    "type": "admin"
  },
  "service": {
    "first_comment_id": "0000000000",
    "id": 000000000,
    "is_resolved": true,
    "last_comment_id": "000000000",
    "notes": "Test",
    "room_id": "00000000",
    "source": "qiscus"
  }
}

New Session Webhook

This webhook will be triggered when a customer sends a message to your Qiscus Omnichannel Chat for the first time or when a customer sends a new message after the previous chat room was resolved.

CURL Sample:

curl --location --request POST 'https:__omnichannel.qiscus.com_api_v2_app_config_new_session_webhook' \\
--header 'Qiscus-Secret-Key: xxxx' \\
--header 'Qiscus-App-Id: xxx' \\
--form 'enabled="true"' \\
--form 'url="http:__target.com"'

Please follow this page to get Qiscus App ID and Qiscus Secret Key.

Sample Response:

{
    "data": {
        "configs": {
            "is_new_session_webhook_enabled": "true",
            "new_session_webhook_url": "http:__target.com"
        }
    },
    "status": 200
}

A sample payload received when the New Session Webhook API is used.

{
    "is_new_session": true,
    "payload": {
        "from": {
            "avatar_url": "https:__latest-omnichannel.qiscus.com_img_default_avatar.svg",
            "email": "xxxxxxx",
            "id": 0,
            "id_str": "0",
            "name": "john doe"
        },
        "message": {
            "id": 0,
            "id_str": "0",
            "payload": null,
            "text": "Halo",
            "timestamp": "2023-09-20T04:39:59Z",
            "type": "text"
        },
        "room": {
            "id": "17xxxxxx",
            "id_str": "17xxxxxxx",
            "is_public_channel": false,
            "name": "Susan Novitasari",
            "options": "{\\"channel\\":\\"wa\\",\\"channel_details\\":{\\"channel_id\\":1xxx,\\"name\\":\\"IsuzuIndonesia\\",\\"phone\\":\\"+628xxxxxxxxxx\\"},\\"is_resolved\\":false,\\"is_waiting\\":true,\\"source\\":\\"wa\\"}",
            "participants": [
                {
                    "email": "xxxxxxxxx"
                },
                {
                    "email": "xxxxxxxxxxxx_admin@qismo.com"
                }
            ],
            "room_avatar": "https:__xxxxxxxxx.qiscus.com_img_default_avatar.svg",
            "topic_id": "17xxxxxxx",
            "topic_id_str": "17xxxxxxx",
            "type": "group"
        }
    },
    "room_log": {
        "channel_id": 14xx,
        "created_at": "2023-09-20T04:39:59",
        "extras": {
            "user_properties": [
                {
                    "key": "Address",
                    "value": "-"
                }
            ]
        },
        "has_no_message": true,
        "is_waiting": true,
        "name": "john doe",
        "resolved": false,
        "room_badge": "https:__xxxxxxx.qiscus.com_img_whatsapp_badge.svg",
        "room_id": "17xxxxxxxx",
        "source": "wa",
        "user_avatar_url": "https:__xxxxxxxxx.qiscus.com_img_default_avatar.svg",
        "user_id": "628xxxxxxxxxxx"
    },
    "webhook_type": "NEW_SESSION_WEBHOOK"
}

User Logout Webhook

This webhook will be triggered when user (admin, supervisor, or agent) logout from Qiscus Omnichannel Chat dashboard. Before you start, you need to register your webhook first using this API.

URL :

[POST] {{BaseUrl}}_api_v2_app_config_auth_webhook

CURL Sample:

curl --location -g --request POST '{{BaseUrl}}_api_v2_app_config_auth_webhook' \\
--header 'Authorization: {{AdminToken}}' \\
--form 'enabled=""' \\
--form 'url=""'

Please follow this page to get your AdminToken.

Sample Response:

{
    "data": {
        "configs": {
            "auth_webhook_url": "https:__webhook.site_xxxxxxxxxxxx",
            "is_auth_webhook_enabled": "true"
        }
    },
    "status": 200
}

Sample payload:

Admin

{
  "payload": {
    "action": "logout",
    "timestamp": 1669004080,
    "user": {
      "avatar_url": null,
      "created_at": "2019-07-24T04:04:13",
      "email": "xxxxxxxxx@xxxxx.com",
      "force_offline": false,
      "id": 4xxx,
      "is_available": true,
      "is_verified": true,
      "last_login": "2022-11-21T02:59:27Z",
      "name": "Hana Tester Qiscus",
      "sdk_email": "xxxxxxxxadmin@xxxxx.com",
      "sdk_key": "dxxxx",
      "type": 1,
      "type_as_string": "admin",
      "updated_at": "2022-11-21T04:14:26"
    }
  },
  "type": "auth"
}

Supervisor

{
  "payload": {
    "action": "logout",
    "timestamp": 1669004271,
    "user": {
      "avatar_url": null,
      "created_at": "2022-08-12T03:01:50",
      "email": "xxxxx@xxxxx.com",
      "force_offline": false,
      "id": 1xxxxx,
      "is_available": true,
      "is_verified": false,
      "last_login": "2022-09-22T07:41:55Z",
      "name": "SPV",
      "sdk_email": "xxxxxspv@xxxxx.com",
      "sdk_key": "ex-xxxx-cxxxxxxx",
      "type": 3,
      "type_as_string": "supervisor",
      "updated_at": "2022-09-22T07:42:18"
    }
  },
  "type": "auth"
}

Agent

{
  "payload": {
    "action": "logout",
    "timestamp": 1669004379,
    "user": {
      "avatar_url": null,
      "created_at": "2022-08-12T03:02:18",
      "email": "xxxxx@xxxxx.com",
      "force_offline": false,
      "id": 1xxxxx,
      "is_available": true,
      "is_verified": false,
      "last_login": "2022-09-22T04:35:24Z",
      "name": "Agen",
      "sdk_email": "xxxxxagen@xxxxx.com",
      "sdk_key": "3x-xxxx-5xxxxxxx",
      "type": 2,
      "type_as_string": "agent",
      "updated_at": "2022-11-21T04:18:45"
    }
  },
  "type": "auth"
}

You can get information regarding the Webhooks using the following CURL.

curl --location 'https:__omnichannel.qiscus.com_api_v2_app_configs?show_all=true' \\
--header 'Qiscus-Secret-Key: xxxx' \\
--header 'Qiscus-App-Id: xxxx'

Sample Response:

{
    "data": {
        "configs": {
            "is_ig_story_mention_enabled:1268_enabled": true,
            "ig_story_mention_enabled:1265": "false",
            "ig_story_mention_enabled:1263": "false",
            "widget": null,
            "default_properties_created": "true",
            "is_waca_channel_enabled": true,
            "is_agent_send_outbound_message_inbox_enabled": true,
            "is_hide_agent_inbox_customer_id_enabled": true,
            "agent_send_outbound_message_inbox": "true",
            "is_ig_story_mention_enabled:1245_enabled": true,
            "is_agent_send_broadcast_message_access_enabled": true,
            "agent_send_broadcast_message_access": "true",
            "ig_story_mention_enabled:1262": "false",
            "new_session_webhook_url": "https:__xxxxxx",
            "is_create_tags_enabled": true,
            "waca_channel": null,
            "is_enable_leave_agent_enabled": true,
            "is_bot_enabled": true,
            "is_agent_takeover_enabled": true,
            "is_mark_as_resolved_webhook_enabled": true,
            "user_hide_handover_request_popup_inbox": "false",
            "is_ig_story_mention_enabled:1263_enabled": true,
            "is_agent_contact_access_enabled": true,
            "is_ig_story_mention_enabled:1261_enabled": true,
            "agent_contact_access": "true",
            "is_default_properties_created_enabled": true,
            "is_user_hide_popup_estimation_inbox_enabled": true,
            "agent_can_add_other_agent": "true",
            "online_message": "Office hours general",
            "user_hide_popup_estimation_inbox": "false",
            "is_api_version_enabled": true,
            "hide_agent_inbox_customer_id": "false",
            "enable_leave_agent": "true",
            "ig_story_mention_enabled:1268": "true",
            "is_ig_story_mention_enabled:1262_enabled": true,
            "is_ig_story_mention_enabled:1265_enabled": true,
            "bot_webhook_url": "https:__xxxx",
            "app_sync_interval": "5000",
            "is_user_hide_handover_request_popup_inbox_enabled": true,
            "agent_can_assign_chat": "true",
            "is_agent_allocation_enabled": true,
            "is_active": true,
            "is_enable_rtl_mode_enabled": true,
            "api_version": "v2",
            "is_new_session_webhook_enabled": "true",
            "is_app_sync_interval_enabled": true,
            "ig_story_mention_enabled:1261": "false",
            "offline_message": "Outside office hours general",
            "is_agent_can_assign_chat_enabled": true,
            "timezone": "+07:00",
            "allocate_agent_webhook_url": ""https:__xxxxxx",
            "hide_agent_toggle_status": "false",
            "is_hide_agent_toggle_status_enabled": true,
            "is_sessional": true,
            "is_allocate_agent_webhook_enabled": false,
            "enable_rtl_mode": "false",
            "is_new_session_webhook_url_enabled": true,
            "ig_story_mention_enabled:1245": "false",
            "create_tags": null,
            "is_agent_can_add_other_agent_enabled": true,
            "is_is_new_session_webhook_enabled_enabled": true,
            "mark_as_resolved_webhook_url": "https:__xxxxxx"
        }
    },
    "status": 200
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *