Webhook events

Channel currently provides only one event, message creation. We plan to add more events later on.

Event structure

When a particular event occurs, we request a POST call to your registered URL with a body with JSON format data. An event JSON format is the following:

  • event: describes an action of the event such as "create", "update" and "push".
  • type: a model that is a target of the event. For now, “Message” and “UserChat”.
  • entity: an actual model data for the type.
  • refers: includes objects if there are more models that have to be addressed

New message

Webhook will notify when a message was created in chat (team or user chat). If you registered keywords in Webhook, we will notify you only when a new message contains one of your keywords.
An entity of the request body will be a Message object.

  • chatType of Message : "group" or "userChat"
  • personType of Message : "manager" or "bot" or "user"

With this event, you can create a chatbot that responds to a certain message.
If you want, you can use our Quick-reply option.

{
   "event":"push",
   "type":"message",
   "entity":{
      "chatKey":"String",
      "id":"String",
      "channelId":"String",
      "chatType":"group",
      "chatId":"String",
      "personType":"manager",
      "personId":"String",
      "requestId":"String",
      "createdAt":1600158433443,
      "version":1,
      "blocks":[
         {
            "type":"text",
            "value":"Hi! Webhook Test"
         }
      ],
      "plainText":"Hi! Webhook Test"
   },
   "refers":{
      "manager":{
         "id":"String",
         "channelId":"String",
         "accountId":"String",
         "username":"String",
         "name":"String",
         "email":"String",
         "mobileNumber":"String",
         "role":"String",
         "removed":Boolean,
         "createdAt":1597800948329,
         "defaultWatch":"String",
         "operator":Boolean,
         "operatorScore":0.0,
         "watchOpenUserChatViaEmail":Boolean,
         "watchOpenUserChatViaMobile":Boolean,
         "avatarUrl": "String"
      },
      "group":{
         "id": "String",
         "channelId": "String",
         "name": "String",
         "scope": "String",
         "managerIds: ["1", "2", "3", "4"],
         "icon": "String",
         "description": "String",
         "createdAt": 1527207802758,
         "updatedAt": 1527207802758,
      }
   }
}

New userchat

Notifies when a new user chat was created. If you registered keywords in Webhook, we will notify you only when a new message contains one of your keywords.

With this event, you can assign one of your manager to the user chat or respond automatically. Refers field contains a user information (User or Veil) and recent message in the user chat.

{
   "event":"push",
   "type":"userChat",
   "entity":{
      "id":"5fe42885827ca5464ceb",
      "channelId":"7",
      "stateKey":"unassigned-5fe428889e3401787d6f",
      "userId":"5fe42881357e98f56691",
      "name":"Koala 205",
      "state":"unassigned",
      "pluginId":"4",
      "sourceUrl":"https://lmevr.channel.io/",
      "firstOpenedAt":1608788104648,
      "openedAt":1608788104648,
      "createdAt":1608788101534,
      "frontMessageId":"5fe428889e3407ca2d56",
      "frontUpdatedAt":1608788104648,
      "deskMessageId":"5fe428889e3407ca2d56",
      "deskUpdatedAt":1608788104648,
      "askedAt":1608788104648,
      "version":3
   },
   "refers":{
      "message":{
         "chatKey":"String",
         "id":"String",
         "channelId":"String",
         "chatType":"userChat",
         "chatId":"String",
         "personType":"user",
         "personId":"String",
         "requestId":"String",
         "createdAt":1600158433443,
         "version":1,
         "blocks":[
            {
               "type":"text",
               "value":"Hi! Webhook Test"
            }
         ],
         "plainText":"Hi! Webhook Test",
         "updatedAt":1608788104649
      },
      "user":{
         "id": "String",
         "channelId": "String",
         "memberId": "String",
         "veilId": "String",
         "name": "String",
         "alert": Integer,
         "unread": Integer,
         "blocked": Boolean,
         "unsubscribeEmail": Boolean,
				 "unsubscribeTexting": Boolean,
         "hasChat": Boolean,
         "hasPushToken": Boolean,
         "language": "String",
         "country": "String",
         "city": "String",
         "latitude": Long,
         "longitude": Long,
         "web": {
           "device": "String",
           "os": "String",
           "osName": "String",
           "browser": "Chrome 80.0.3987.132",
           "browserName": "Chrome",
           "sessionsCount": 5,
           "lastSeenAt": 1584673657636
         },
         "sessionsCount": Integer,
         "lastSeenAt": 1584673657636,
         "createdAt": 1584145649408,
         "updatedAt": 1584934318716,
         "version": Integer,
         "member": Boolean,
         "contact": Boolean,
         "avatarUrl": "String",
         "systemLanguage": "String"
      }
   }
}