patch https://refer-base-url-sub-domains.imi.chat/v3.1/chats/
This endpoint allows you to update the details of a chat.
The PATCH /chats only allow you to update the following parameters of the chat resource:
| Param Name | Data Type | Description |
|---|---|---|
| alias_id | string | External ID that can be used to reference a chat |
| tags | ARRAY | Array of tags to apply on a chat. Any existing tags will be replaced with this array |
| status | enum | Status of the chat. Possible Values: - queued- picked - onhold- closed |
| assignee | string | Login ID of the user the chat is currently assigned to |
| outcome | string | Reason of closure when updating a chat's status as Closed |
| other_details | OBJECT | Contains additional information linked to a chat as Key Value Pairs |
Response Params:
| Param Name | Description |
|---|---|
| status_code | Denotes the status of the response. Detailed guide can be found here |
| description | States the description of the status_code. Gives you information about the success/error |
| response | Contains details of the current resource fetched/updated/created |
Chat List OBJECT
| Parameter | Data Type | Description |
|---|---|---|
| team_id | integer | Unique identifier of the team that chat resides in |
| team_name | string | Name of the team that the chat resides in |
| chat_id | string | Unique identifier of a chat |
| alias_id | string | External ID that can be used to reference a chat |
| created_at | datetime - UTC Format | Timestamp when chat was created |
| updated_at | datetime -UTC Format | Timestamp when chat was last updated |
| status | enum | Current status of the chat. Possible Values: - queued- picked - onhold- closed |
| channel | enum | Channel on which chat has been created: - sms- facebook- twitter- livechat- email- abc- whatsapp- api |
| subject | string | Subject of the Email chat Applicable to Email channel alone |
| asset | Asset OBJECT | An object containing the details of the channel asset that the chat has been created on |
| customer | Customer OBJECT | An object containing the details of the end customer |
| messages | Message OBJECT | An object containing messages exchanged within the chat |
| assignee | string | Login ID of the user the chat is currently assigned to |
| flag | string | Flag currently applied on a chat |
| tag | ARRAY | Array of tags currently applied on a chat |
| other_details | OBJECT | Contains additional information linked to a chat as Key Value Pairs |
Asset OBJECT
| Parameter | Data Type | Description |
|---|---|---|
| id | integer | Unique identifier of the channel asset based on the channel: - SMS - Longcode- Facebook - Page ID- Twitter - Owner ID- Email - Business Email ID (From Address)- API - Service Key- Livechat - App ID- Apple Business Chat - Service Key- WhatsApp Business - Service Key |
| name | string | Name of the Asset |
Note
Please reach out to your Account Manager/Customer Success Representative/Support Team for asset details of the following channels:
Livechat
Apple Business Chat
Customer OBJECT
| Param Name | Data Type | Description |
|---|---|---|
| id | integer | Unique identifier of the customer |
| destination_id | string | The destination ID of the end customer being addressed based on the channel - SMS - Mobile No- Facebook - PS ID- Twitter - Twitter ID- Email - Email ID- API - User ID- Livechat - Livechat ID- Apple Business Chat - ABC Opaque User ID- WhatsApp Business - WhatsApp Mobile Number |
| name | string | Name of the end-customer |
Inbound Message Sample Codes
{
"type": "inbound",
"text": "This is a sample inbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"text": "This is a sample inbound message",
"attachment": {
"type": "image | audio | video | file",
"url": "<hosted URL of the attachment>"
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"attachment": {
"type": "image | audio | video | file",
"url": "<hosted URL of the attachment>"
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"abc_sub_type": "text",
"text": "This is a sample inbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"abc_sub_type": "listpicker_response",
"listpicker_response": [
"item1",
"item2"
],
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"abc_sub_type": "timepicker_response",
"timepicker_response": "2019-08-16T22:02:13.842Z",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"livechat_sub_type": "text",
"text": "This is a sample inbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "inbound",
"livechat_sub_type": "quick_replies",
"quick_reply_response": {
"request_identifier": "13jh1k2j3h-1kj23hk12j-1kj2h3k1j2-12j3hk12j",
"options": [
{
"title": "Option 2"
}
]
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
Outbound Message Sample Codes
{
"type": "outbound",
"text": "This is a sample inbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"text": "This is a sample outbound message",
"attachment": {
"type": "image | audio | video | file",
"url": "<hosted URL of the attachment>"
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"attachment": {
"type": "image | audio | video | file",
"url": "<hosted URL of the attachment>"
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"template_name": "template name",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"whatsapp_sub_type": "text",
"text": "This is a sample outbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"whatsapp_sub_type": "hsm",
"template_name": "<Sample HSM Template Name>",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"livechat_sub_type": "text",
"text": "This is a sample outbound message",
"timestamp": "2019-08-16T22:02:13.842Z"
}
{
"type": "outbound",
"livechat_sub_type": "quick_replies",
"quick_replies": {
"request_identifier": "12kj3h1k2j-23jkh43j-2kj3h4j-2k3j4h3jk",
"options": [
{
"title": "Option 1",
"payload": "option-1"
}
]
},
"timestamp": "2019-08-16T22:02:13.842Z"
}
| Param Name | Data Type | Description |
|---|---|---|
| type | enum | Direction of the message - inbound- announcement- outbound |
| abc_sub_type | enum | Specifies the message type of inbound ABC message being appended - text- listpicker- timepicker |
| livechat_sub_type | enum | Specifies the message type of inbound and outbound livechat messages being appended - text- quick_reply_response |
| whatsapp_sub_type | enum | Specifies the message type of outbound WhatsApp message being appended - text- hsm |
| list_picker_response | ARRAY | Array of items titles chosen by the customer on ABC |
| time_picker_response | datetime - UTC format | UTC timestamp of the start time of the event slot chosen by customer on ABC |
| template_name | string | Specifies the template name/id of outbound templates sent on a chat. This is applicable to outbound messages on ABC and WhatsApp channels only |
| text | string | Text content of the message |
| attachment | Attachment OBJECT | An object containing details of the attachments sent/received by the user |
| quick_replies | Quick Replies OBJECT | An object containing details of the quick replies sent to the end-customer Applicable to Livechat channel alone |
| quick_reply_response | Quick Reply Response OBJECT | An object containing details of the quick replies received from the end-customer Applicable to Livechat channel alone |
| timestamp | datetime - UTC format | Timestamp when the message was sent or received by the user |
Note
Please refer to the individual code examples for each of the message type and directions for additional information and clarifications
Attachment OBJECT
| Param Name | Data Type | Description |
|---|---|---|
| type | enum | Type of attachment. Allowed values: - image- audio- video- file |
| url | string | Hosted URL of the attachment |
Quick Replies OBJECT
| Param Name | Data Type | Description |
|---|---|---|
| request_identifier | string - Preferrably a GUID | Unique identifier of a request made to Livechat widget |
| options | ARRAY | Array of quick reply object containing the following params: - title - payload |
Quick Reply Response OBJECT
| Param Name | Data Type | Description |
|---|---|---|
| request_identifier | string - Preferrably a GUID | Unique identifier of a request made to Livechat widget |
| options | ARRAY | Array of quick reply object containing the following params: - title |
Response Codes
| status_code | HTTP Status | Description |
|---|---|---|
| 4304 | 200 | The chat details retrieved successfully |
| 2002 | 400 | Invalid header param - could not find mandatory header parameters |
| 2003 | 400 | Invalid Access Token |
| 2004 | 401 | Access Token expired |
| 2031 | 404 | Provided Chat ID does not exist |
| 2007 | 500 | Internal Server Error |
| 2010 | 404 | Could not find details of team based on the teamid passed in the header |
| 2099 | 405 | Method not allowed |
| 4108 | 500 | Unable to get the chat details |
