Webhook
The Webhook feature pushes events on the Hyphenate Customer Engagement Cloud to third-party servers.
Webhook is a value-added service. To activate it, please provide the tenant ID and contact Hyphenate.
Create Webhook
To push an event to a third-party server:
- Activate the Webhook feature.
- Go to “Admin Mode > Settings > Webhook”.
- Click Create Webhook, enter the name and server URL, select an event, and click Save.
Events
Hyphenate can push the following events:
Conversation Closed
Event name: ServiceSessionClosedEvent
Example of message content:
{
"eventId": "ca81ade0-6dc5-11e6-9c13-dfa1eed70626",
"timestamp": 1472460726612,
"event": "ServiceSessionClosedEvent", // Event type
"payload": {
"serviceSession": {
"id": "4fe1b496-90ac-4412-8f40-0f6a13cbfc4b", // Conversation ID
"state": "Terminal",
"origin_type": "webim", // Channel type, webim indicates web channel
"timestamp": {
"create": 1472139263000, // Time the conversation was created
"start": 1472139269000, // Time the conversation starts
"stop": 1472460695000 // Time the conversation is closed
},
"channel": { // Channel account
"id": 3104,
"name": "Quick IM account", // Channel account name
"type": "easemob" // Channel account type, easemob indicates Hyphenate IM
},
"visitor": {
"id": "a6527ed1-e3f4-4537-aeef-ae35199e3765", // Customer ID
"name": "webim-visitor-RY7KQK99XVGXBE3JKCHM", // Customer nickname
"channel_user": { // Channel account information
"app_name": "sandbox",
"channel_type": "easemob",
"im_id": "webim-visitor-RY7KQK99XVGXBE3JKCHM", // Hyphenate ID of the channel account
"org_name": "sipsoft"
}
},
"agent": {
"id": "b58b99c1-cd3b-44d9-9821-20fb6a0f2f49", // Agent ID
"name": "Admin", // Agent nickname
"type": "Agent" // Agent's role. The value is robot, agent or admin
},
"agent_queue": {
"id": 2112,
"name": "Team Alpha" // Team name
},
"summary_category": [ // Conversation tags. An array that contains all conversation tags of the conversation
{
"id": 23976,
"name": "Test"
}
],
"comment": "", // Conversation remarks
"enquiry":{
"score":3, // Satisfaction ratings
"comment":"" // Satisfaction remarks
}
}
}
}
New Message
Event name: ServiceSessionMessageEvent
Example of message content:
Text message
{
"eventId": "3a7e82a0-aa60-11e5-8544-5111ba4b872e",
"timestamp": 1450976598050,
"event": "ServiceSessionMessageEvent",
"payload": {
"message": {
"id": "dad14e23-4566-4ca6-b10e-fceeb59c42c2", // Message ID
"service_session_id": "4e27dd5e-683d-4664-a0db-bb8457ec7101", // Conversation ID
"from": {
"id": "27f74a74-5139-4f8c-b65f-15129e7808a8", // Sender ID (agent or customer)
"name": "Admin", // Nickname
"type": "Agent" // Role
},
"origin_type": "app", // Channel
"channel": { // Channel account
"id": 21,
"type": "easemob" // Channel account type
},
"body": {
"type": "txt", // Message type: text
"msg": "asdf" // Message content
}
}
}
}
Image message
{
"eventId": "bc4a6120-aa68-11e5-b3c3-dd9f501463d3",
"timestamp": 1450980251761,
"event": "ServiceSessionMessageEvent",
"payload": {
"message": {
"id": "dc5004d7-39ce-4a03-bca0-af2c16b269d6",
"service_session_id": "4e27dd5e-683d-4664-a0db-bb8457ec7101",
"from": {
"id": "2cb00d04-60f3-48a4-93b8-caf15b22a262",
"name": "fa38294841604ac89ba2815689f8f636",
"type": "Visitor"
},
"origin_type": "app",
"channel": {
"id": 21,
"name": "yaaa",
"type": "easemob"
},
"body": {
"type": "img", // Message type: image
"url": "/v1/Tenant/5631/MediaFiles/df56bebd-433c-4b0e-aab9-1684fb75999f", // Download address of the image
"secret": "u9X0eqpoEeW-Hw1NajGLHchLw_cjQA0WifvU7Lid7UsaLafh",
"filename": "image.jpg", // File name
"size": { // Image size
"width": 2448,
"height": 3264
}
}
}
}
}
Agent Created
Event name: AgentUserCreationEvent
Example of message content:
{
"eventId": "cfb76910-a9fa-11e5-844c-37fa6bbad3ec",
"timestamp": 1450933062687,
"event": "AgentUserCreationEvent",
"payload": {
"agent": {
"id": "614f3fb7-d757-4894-ba17-90a7c1488a59",
"username":"a@qq.com",
"nickname":"agent1",
"name":"aaaa",
"roles":["admin","agent"],
"business_id":"11111",
"phone":"13311111111",
"created_at":123412341234,
"updated_at":123412342123
}
}
}
Agent Status Changed
The online status of an agent or admin includes: online, busy, away, invisible, and offline. Agents and admins can switch their online status. For details about the online status, see Conversations.
The Agent Status Changed event is sent when an agent or admin changes his online status.
Event name: AgentUserStateChangedEvent
Example of message content:
{
"eventId": "45114db0-d639-11e5-91c0-a11acb243a77",
"timestamp": 1455797716755,
"event": "AgentUserStateChangedEvent",
"payload": {
"agent": {
"id": "28d0a4aa-bf19-4724-ab9d-3b74afed34a8",
"nickname": "Admin",
"username": "licx@easemob.com"
},
"status": "Online",
"stateChangeTime": 1455797716491
}
}
Agent Logged Out
Event name: AgentUserLogoutEvent
Example of message content:
{
"eventId": "a9928560-d639-11e5-8447-854851e278ee",
"timestamp": 1455797885117,
"event": "AgentUserLogoutEvent",
"payload": {
"agent": {
"id": "28d0a4aa-bf19-4724-ab9d-3b74afed34a8",
"nickname": "Admin",
"username": "licx@easemob.com"
},
"logoutTime": 1455797885109
}
}
Agent Deleted
Event name: AgentUserDeletedEvent
Example of message content:
{
"eventId": "07ffc670-ce74-11e6-a4aa-e9370bc22534",
"timestamp": 1483090934322,
"event": "AgentUserDeletedEvent",
"payload": {
"agent": {
"id": "4b4f0f36-8286-4ccd-8e99-50b33cfdf958",
"username": "713test10@qq.com",
"nickname": "10",
"name": "",
"roles": [
"agent"
],
"phone": "",
"created_at": 1483090749000,
"updated_at": 1483090749000
}
}
}
Add Customer Tag
Event name: VisitorTagAddedEvent
Example of message content:
{
"eventId": "9f727ee0-07b7-11e7-b77f-3b3c6fac2bb4",
"timestamp": 1489387089477,
"event": "VisitorTagAddedEvent",
"payload": {
"visitorUserTag": {
"visitorUserId": "2ad4af98-903a-4050-9cea-2d5807c85002",
"userTagId": 5596,
"tag": {
"tagName": "Common customer",
"created_at": 1436805675000
}
}
}
}
Delete Customer Tag
Event name: VisitorTagRemovedEvent
Example of message content:
{
"eventId": "a7364210-07b7-11e7-9a61-dbd5753351ee",
"timestamp": 1489387102520,
"event": "VisitorTagRemovedEvent",
"payload": {
"visitorUserTag": {
"visitorUserId": "2ad4af98-903a-4050-9cea-2d5807c85002",
"userTagId": 5596,
"tag": {
"tagName": "Common customer",
"created_at": 1436805675000
}
}
}
}
Modify Customer Profile
Event name: VisitorUserChangeEvent
Example of message content:
{
"eventId": "b9c1e0b0-07b7-11e7-8ab4-53b659cd1343",
"timestamp": 1489387133611,
"event": "VisitorUserChangeEvent",
"payload": {
"visitor": {
"id": "2ad4af98-903a-4050-9cea-2d5807c85002",
"username": "webim-visitor-EM3GEFC7TBQVRXYM6GGC",
"nickname": "Leoli",
"name": "Leoli",
"roles": [
"visitor"
],
"gendar": 0,
"created_at": 1488884778000,
"updated_at": 1489387133493
}
}
}
Agent Info Changed
Event name: AgentUserChangeEvent
Example of message content:
{
"eventId": "d0a31dd0-07b7-11e7-b1a7-eb03c0f01476",
"timestamp": 1489387172031,
"event": "AgentUserChangeEvent",
"payload": {
"agent": {
"id": "eb524dc0-be91-47ac-b6e6-10d013d7d72b",
"username": "713test4@qq.com",
"nickname": "Leoli",
"name": "leoli",
"roles": [
"admin",
"agent"
],
"phone": "18612389889",
"business_id": "1001",
"created_at": 1453900968000,
"updated_at": 1489128601000
},
"old_agent": {
"id": "eb524dc0-be91-47ac-b6e6-10d013d7d72b",
"username": "713test4@qq.com",
"nickname": "Leoli",
"name": "",
"roles": [
"admin",
"agent"
],
"phone": "",
"created_at": 1453900968000,
"updated_at": 1489128601000
}
}
}