Conversation module

The Conversation module allows you to track and respond to conversation-based interactions between your website visitors and your operators. It includes data such as messages sent by visitors or operators, the operators involved, supervisors assigned, and other metadata tied to each conversation.

This module supports various conversation-related events, like when a conversation starts, ends, gets rated, is missed, or transferred. You can configure workflows based on these events and set up actions that respond to specific rule conditions.

Payload delivery: Webhooks & Deluge

When a workflow is triggered, the event data is delivered as a payload. The way you access this payload depends on the action platform you choose:

  • Webhooks: The payload is sent as a POST request to the webhook URL you configured. Your external system can read the JSON body to process the event data.
  • Deluge Scripts: The  payload is made available through the built-in entity parameter in your script. You can extract specific data using entity object based on the structure of the event.

To get the visitor's name from the "conversation.created" event payload:

Copied//Syntax
visitor_name = entity.get("<key_name>")
//Example
visitor_name = entity.get("visitor").get("name")

Events

Here is the list of events supported under the Conversation module:

conversation.created

You can subscribe to this event if you wish to be notified when a visitor initiates a chat.

Payload

Copied{
  "id": "17000000004021",
  "visitor_conversation_id": "ad433hjdid546f8n4b734j4omfhjsrwnet46fklf7",
  "reference_id": "1",
  "opened_time": "1556866331533",
  "attended_time": "1556866331553",
  "end_time": "1556866331929",
  "missed_time": "1556866333232",
  "app_id": "30185567778889",
  "department_id": "301050000004",
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"1234354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
  },
  "question": "Hi, I need some assistance in buying a dining set.",
  "supervisors": [
    "30102333033336",
    "30102333033337"
  ],
  "participants": [
    "30102333033336",
    "30102333033337"
  ],
  "status": "Live",
  "chat_status": {
    "status_code": [
      "1,2"
    ],
    "state": [
      "1,2,3,4"
    ],
    "label": "Live"
  },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  } 
}

conversation.missed

You can subscribe to this event if you wish to be notified when a chat initiated by the visitor is not picked up by any operator and missed.

Payload

Copied{
  "id": "17000000004021",
  "visitor_conversation_id": "ad433hjdid546f8n4b734j4omfhjsrwnet46fklf7",
  "reference_id": "1",
  "opened_time": "1556866331533",
  "attended_time": "1556866331553",
  "end_time": "1556866331929",
  "missed_time": "1556866333232",
  "app_id": "30185567778889",
  "department_id": "301050000004",
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"12344354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
  },
  "question": "Hi, I need some assistance in buying a dining set.",
  "supervisors": [
    "30102333033336",
    "30102333033337"
  ],
  "participants": [
    "30102333033336",
    "30102333033337"
  ],
  "status": "Missed",
  "chat_status": {
    "status_code": [
      "1,2"
    ],
    "state": [
      "1,2,3,4"
    ],
    "label": "Tracked in CRM"
  },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}

conversation.completed

You can subscribe to this event if you wish to be notified when a chat conversation ends.

Payload

Copied{
  "id": "17000000004021",
  "visitor_conversation_id": "ad433hjdid546f8n4b734j4omfhjsrwnet46fklf7",
  "reference_id": "1",
  "opened_time": "1556866331533",
  "attended_time": "1556866331553",
  "end_time": "1556866331929",
  "missed_time": "1556866333232",
  "app_id": "30185567778889",
  "department_id": "301050000004",
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
     "email_id":"tricia@zylker.com",
     "phone":"12344354",
     "name":"Tricia",
     "type" : "contact",
     "id": "30000000090034"
  },
  "question": "Hi, I need some assistance in buying a dining set.",
  "supervisors": [
    "30102333033336",
    "30102333033337"
  ],
  "participants": [
    "30102333033336",
    "30102333033337"
  ],
  "status": "Closed",
  "chat_status": {
    "status_code": [
      "1,2"
    ],
    "state": [
      "1,2,3,4"
    ],
    "label": "Attended by Email"
  },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}

conversation.rated

You can subscribe to this event if you wish to be notified when visitors rate or provide feedback on the chat conversation they had with the operator.

Payload

RatingFeedback
Copied{
  "rating": 4,
  "feedback": "Good support",
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"12344354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
  },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}
Copied{
  "entity_type": "conversation",
  "org_id": "55778119",
  "event": "conversation.rated",
  "entity_id": "40526000001808033",
  "attempt": 1,
  "version": "1",
  "app_id": 40526000000002040,
  "entity": {
    "owner": {
      "name": "Patricia",
      "email_id": "patricia@zylker.com"
      "id": "40526000000002001"
    },
    "feedback": "Awesome support from the reps!",
    "id": "40526000001808033",
    "status": "Ended",
    "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"12344354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
       }
  },
  "event_time": "1567065865617",
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}

conversation.attender.updated

You can subscribe to this event if you wish to be notified when operators pick up a chat.

Payload

Copied{
  "id": "17000000004021",
  "visitor_conversation_id": "ad433hjdid546f8n4b734j4omfhjsrwnet46fklf7",
  "reference_id": "1",
  "opened_time": "1556866331533",
  "attended_time": "1556866331553",
  "end_time": "1556866331929",
  "missed_time": "1556866333232",
  "app_id": "30185567778889",
  "department_id": "301050000004",
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"124534354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
     }
  },
  "question": "Hi, I need some assistance in buying a dining set.",
  "supervisors": [
    "30102333033336",
    "30102333033337"
  ],
  "participants": [
    "30102333033336",
    "30102333033337"
  ],
  "status": "Connected",
  "chat_status": {
    "status_code": [
      "1,2"
    ],
    "state": [
      "1,2,3,4"
    ],
    "label": "Attended Online"
  },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}

conversation.operator.replied

You can subscribe to this event if you wish to be notified when an operator replies to the chat initiated by the visitor.

Payload

Copied{
"id":"8000000004009",
"message":{
"sender":{
"name":"Tricia",
"id":"8000000000005"
},
"msgid":"1566480708251",
"text":"Hi, I need some assistance in buying a dining set."
},
"visitor":{
"email_id":"tricia@zylker.com",
"phone":"12344354",
"name":"Tricia",
"type" : "contact",
"id": "30000000090034"
},
"owner":{
"id":"30102333033335",
"name":"Patricia",
"email_id":"patricia@zylker.com"
},
"version":1
}

Bot Conversation Payload:

{
message : {
"sender" : {
"id" : $sender wms id,
"name" : $sender name
},
"text" : $msg,   // Absent for bot message
"msgid" : $msg id,   // Absent for bot message
"meta" : $meta data, ---> applicable for bot message
"list" : [
$MESSAGE LIST
  ]
 },
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }
}

conversation.visitor.replied

You can subscribe to this event if you wish to be notified when a visitor replies.

Payload

Copied{
  "id": "8000000005001",
  "message": {
    "sender": {
      "name": "Tricia",
      "id": "$2463902591169630574"
    },
    "msgid": "1566481170562",
    "text": "Hi, i need some assistance in buying a dining set"
  },
  "owner": {
    "id": "30102333033335",
    "name": "Patricia",
    "email_id": "patricia@zylker.com"
  },
  "visitor":{
        "email_id":"tricia@zylker.com",
        "phone":"1234354",
        "name":"Tricia",
        "type" : "contact",
        "id": "30000000090034"
  },
  "version": 1
},
   "customer_info": {
   "Branch": "California",
   "Band": "Premium"
  }

conversation.transfer.initiated

You can subscribe to this event if you wish to be notified when a conversation transfer is initiated.

Payload

Copied{
    "owner": {
        "email_id": "patricia@zylker.com",
        "name": "patricia@zylker.com",
        "id": "30000000099007"
    },
    "transfer": {
        "note": "More info required",
        "type": "user|department",
        "department_id": "30000000148001",
        "transferred_by": {
            "type": "bot|operator",
            "email_id": "patricia@zylker.com",
            "name": "patricia@zylker.com",
            "id": "30000000099007"
        },
        "transferred_to": [
            {
                "id": "30000000000006",
                "name": "Patricia",
                "email_id": "patricia@zylker.com"
            }
        ]
    },
    "waiting_time": "60",
    "question": "Hi, I need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "id": "30000000095001",
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d",
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    }

conversation.transfer.accepted

You can subscribe to this event to be notified when the operator accepts a transferred chat.

Payload

Copied{
    "accepted_by": {
        "name": "Patricia",
        "id": "30000000000006",
        "email_id": "patricia@zylker.com"
    },
    "question": "Hi, i need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "id": "30000000158001",
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "visitor_conversation_id": "2d665c42a02e919a171b7845509162e6"
}

conversation.transfer.rejected

You can subscribe to this event to be notified when the operator rejects a transferred chat.

Payload

Copied{
    "rejected_by": {
        "type": "auto | manual",
        "name": "Patricia",
        "id": "30000000000006",
        "email_id": "patricia@zylker.com"
    },
    "question": "Hi, i need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "id": "30000000158001",
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d"
}

conversation.participants.added

You can subscribe to this event if you wish to be notified when participants are invited to the chat.

Payload

Copied{
    "question": "Hi, i need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "id": "30000000095001",
    "invite": {
        "note": "asdfqsf",
        "added_by": {
            "name": "patricia@zylker.com",
            "id": "30000000099007",
            "email_id": "patricia@zylker.com"
        },
        "added_operators": [
            {
                "name": "Patricia",
                "id": "30000000000006",
                "email_id": "patricia@zylker.com"
            }
        ]
    },
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d",
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "owner": {
        "name": "Patricia",
        "id": "30000000000006",
        "email_id": "patricia@zylker.com"
    }
}

conversation.participants.deleted

You can subscribe to this event if you wish to be notified when a participant is removed from a conversation.

Payload

Copied{
    "question": "Hi, i need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "deleted_by": {
        "name": "Patricia",
        "id": "30000000000006",
        "email_id": "patricia@zylker.com"
    },
    "deleted_operators": [
        {
            "name": "Patricia+1",
            "id": "30000000000106",
            "email_id": "patricia@zylker.com"
        }
    ],
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "owner": {
        "name": "Patricia",
        "id": "30000000000006",
        "email_id": "patricia@zylker.com"
    },
    "id": "30000000095001",
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d"
}

conversation.supervisor.added

You can subscribe to this event if you wish to be notified when a supervisor is added to the chat.

Payload

Copied{
    "added_operators": [
        {
            "name": "Patricia",
            "id": "30000000000006",
            "email_id": "patricia@zylker.com"
        }
    ],
    "id": "30000000095001",
    "question": "Hi, I need some assistance in buying a dining set",
    "department_id": "30000000000018",
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "owner": {
        "name": "Patricia+1",
        "id": "30000000000106",
        "email_id": "patricia@zylker.com"
    },
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d"
}

conversation.message.edited

You can subscribe to this event if you wish to be notified when a message is edited in chat.

Payload

Copied{
    "id": "8000000005001",
    "message": {
        "sender": {
            "name": "Patricia",
            "id": "30000000000006"
        },
        "msgid": "1566481170562",
        "text": "abcc"
    },
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "owner": {
        "name": "Patricia+1",
        "id": "30000000000106",
        "email_id": "patricia@zylker.com"
    },
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d"
}

conversation.message.deleted

You can subscribe to this event if you wish to be notified when a message is deleted in chat.

Payload

Copied{
    "id": "8000000005001",
    "message": {
        "sender": {
            "name": "Patricia",
            "id": "30000000000006"
        },
        "msgid": "1566481170562"
    },
    "visitor": {
        "email_id": "tricia@zylker.com",
        "phone": "1234354",
        "name": "Tricia",
        "type": "contact",
        "id": "30000000090034"
    },
    "owner": {
        "name": "Patricia+1",
        "id": "30000000000106",
        "email_id": "patricia@zylker.com"
    },
    "visitor_conversation_id": "2d665c42a02e919ac0f91f62fa78581d",
}
You can subscribe to this event to receive notifications containing the metrics/metadata of a conversation once it has concluded.

Payload

Copied{
    "entity_type": "conversation",
    "org_id": "65423290",
    "event": "conversation.metrics",
    "entity_id": "115844000014120021",
    "attempt": 1,
    "version": "1",
    "app_id": "115844000002965011",
    "entity": {
        "inititated_by": "visitor",
        "question": "12",
        "end_time": "1721653023236",
        "chat_id": "29115",
        "connected_time": "1721653003085",
        "opened_time": "1721652997651",
        "ended_by": "agent",
        "id": "115844000014120021",
        "metrics": {
            "operator_message_count": "2",
            "visitor_message_count": "3",
            "bot_message_count":"2",
            "info_message_count":"4",
            "system_event_count":"1",
            "average_response_time": "5792",
            "first_response_time": "6105",
            "total_chat_duration": "20151",
            "visitor_waiting_time": "5434",
            "missed_reason":"All the operators are busy.",
            "bot_pickup_after":"1721652997651",
            "bot_duration":"172165299764",
            "queued_duration":"1721652997751",
            "first_agent_accept_after":"1721652999651",
            "total_operator_duration":"1721652997651",
            
        },
        "time": {
            "initiated_time":"1721652997651",
            "connected_time":"1721652997655",
            "bot_pickup_time":"1721652997655",
            "bot_transfer_time":"1721652997687",
            "queue_intime":"1721652997651",
            "queue_outtime":"1721672997651",
            "missed_time":"1721652997653",
            "connected_time":"1721652997651",
            "first_agent_accept_time":"1721652998651",
            "end_time":"1721652998651",
            "last_mail_at","1721652999651"
        },
        "department": {
            "name": "Support",
            "id": "115844000000002016"
        },
        "brand": {
            "name": "Zylker Shop",
            "id": "115844000002965011"
        },
        "attender": {
            "name": "James",
            "id": "115844000003392001",
            "type": "operator"
        },
        "status": "Attended Online"
    },
    "event_time": "1721653023413"
}