--- title: "Ticket" slug: "server-api-ticketing-ticket" updated: 2022-08-31T05:10:38Z published: 2022-08-31T05:10:38Z canonical: "developer.comm100.com/server-api-ticketing-ticket" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.comm100.com/llms.txt > Use this file to discover all available pages before exploring further. # Ticket ## Ticket - `Ticket` - Ticket Manage - `GET ticketing/tickets` - [Get the list of Ticket](/docs/server-api-ticketing-ticket#get-the-list-of-ticket) - `GET ticketing/tickets/{id}` - [Get a single Ticket](/docs/server-api-ticketing-ticket#get-a-single-ticket) - `POST ticketing/tickets` - [Create a new Ticket](/docs/server-api-ticketing-ticket#create-a-new-ticket) - `POST ticketing/tickets/{id}:merge` - [Merge ticket](/docs/server-api-ticketing-ticket#merge-ticket) - `POST ticketing/tickets/{id}:read` - [Read the Ticket](/docs/server-api-ticketing-ticket#read-the-ticket) - `POST ticketing/tickets/{id}:recycle` - [Recycle the ticket.](/docs/server-api-ticketing-ticket#recycle-the-ticket.) - `POST ticketing/tickets/{id}:unread` - [Unread the Ticket](/docs/server-api-ticketing-ticket#unread-the-ticket) - `POST ticketing/tickets:unreadCount` - [Get unread count of the ticket.](/docs/server-api-ticketing-ticket#get-unread-count-of-the-ticket.) - `PUT ticketing/tickets/{id}` - [Update the Ticket](/docs/server-api-ticketing-ticket#update-the-ticket) - `DELETE ticketing/tickets/{id}` - [Remove the Ticket](/docs/server-api-ticketing-ticket#remove-the-ticket) ### Ticket JSON Format Ticket is represented as simple flat JSON objects with the following keys: | Name | Type | Description | | --- | --- | --- | | `id` | int | Auto Increment Id of the ticket | | `subject` | string | Subject of the ticket. | | `originalConversationId` | string | Conversion Id in original channel. | | `assigneeId` | guid | Id of agent or chatbot that the ticket is assigned to. | | `departmentAssigneeId` | guid | Id of department that the ticket is assigned to. | | `channelId` | string | Id of the channel of the first message of the ticket. | | `channelAccountId` | guid | Id of the channel account of the first message of the ticket. | | `lastMessageId` | guid | Id of the last message of the ticket. | | `lastMessageChannelId` | string | Id of the channel of the last message of the ticket. | | `lastMessageChannelAccountId` | guid | Id of the channel account of the last message of the ticket. | | `contactOrVisitorId` | guid | Id of the contact or visitor that the ticket related to. | | `createdById` | guid | Id of role(contact, visitor, chatbot, channelAccount, system, agent) who created the ticket. | | `lastRepliedById` | guid | Id of role who last replied the ticket. | | `resolvedById` | guid | Id of role resolved the ticket. | | `assigneeType` | string | Type of the ticket assignee. Allowed values are "agent", "chatbot". | | `contactOrVisitorType` | string | Type of the ticket contact. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `status` | string | Status of the ticket. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `priority` | string | Priority of the ticket. Allowed values are "urgent", "high", "normal", "low". | | `createdByType` | string | Who created the ticket. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `lastRepliedByType` | string | Who replied the ticket recently. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `resolvedByType` | string | Who the ticket is resolved by. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `isReadByAgent` | bool | Whether the ticket is read by any agent or not. | | `isReadByContact` | bool | Whether the ticket is read by the contact or not. | | `ifHasDraft` | bool | Whether the ticket has draft or not. | | `mergedToTargetId` | integer | Id of the ticket that it was merged to. | | `totalReplies` | integer | Total number of messages, replied by agents, contacts or visitor. | | `createdTime` | datetime | Time when the ticket is created. | | `lastUpdatedTime` | timestamp | Last updated time of the ticket. | | `lastRepliedTime` | datetime | Last replied time of the ticket. | | `lastStatusChangedTime` | datetime | Last status changed time of the ticket. | | `resolvedTime` | datetime | Resloved time of the ticket. | | `isInRecycleBin` | bool | Whether the ticket is in recyle bin or not. | | `reopenedTime` | datetime | Time when the resolved ticket was reopened. | | `responseTimeSpan` | long | Total amount of time the status of the ticket was pending internal. | | `replyingAgent` | string | Allowed values are "noReply", "agentOnly", "botOnly", "agentAndBot". | | `responseCount` | long | Number of replies. | | `resolvedTimeSpan` | long | Total time it took to resolve the ticket. | | `firstResponseTimeSpan` | long | Time it took for the agent to send the first response after a ticket is created. | | `tags` | [tags[]](/docs/ticketingtag) | Reference to Tag. | | `draft` | [draft](/docs/ticketingdraft) | Reference to Draft. | | `noteMentions` | [noteMentions[]](/docs/server-api-ticketing-ticket#notemention-json-format) | Reference to NoteMention. | | `tagIds` | array | The list of tag which belongs to the ticket. | ### NoteMention JSON Format: | Name | Type | Description | | --- | --- | --- | | `isReadByAgent` | bool | Whether the mention has been read by agent or not. | | `noteId` | guid | Id of the note which the mention belongs to. | | `id` | guid | Id of the mention. | | `agentId` | guid | Id of the mentioned agent. | | `ticketId` | selfIncrementId | Id of the ticket which the note belongs to. | ### Get the list of Ticket `GET ticketing/tickets` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `tagid` | guid | query | no | Filter by tag id. | | `time` | datetime | query | no | Filter by last updated time. | | `lastRepliedTime` | datetime | query | no | Filter by last replied time. | | `keywords` | string | query | no | Keyword for searching | | `viewId` | guid | query | no | Id of view | | `contactOrVisitor` | guid | query | no | Id of contact or visitor | | `contactOrVisitorType` | string | query | no | Contact or Visitor | | `include` | string | query | no | Allowed values are "ticketingTag", "ticketingEventLog", "ticketingDraft", "ticketingMessage", "lastMessage", "assignee", "departmentAssignee", "createdBy", "lastRepliedBy", "contactOrVisitor". | - #### Response: An array of [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets \ -X 'GET' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "tickets": [ { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": false, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ], "nextPage": null, "previousPage": null, "total": 1 } ``` ### Get a single Ticket `GET ticketing/tickets/{id}` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `include` | string | query | no | Allowed values are "ticketingTag", "ticketingEventLog", "ticketingDraft", "ticketingMessage", "lastMessage", "assignee", "departmentAssignee", "createdBy", "lastRepliedBy", "contactOrVisitor". | - #### Response: [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11 \ -X 'GET' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": false, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Create a new Ticket `POST ticketing/tickets` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `subject` | string | body | yes | Subject of the ticket. | | `originalConversationId` | string | body | no | Conversion Id in original channel. | | `assigneeId` | guid | body | no | Id of agent or chatbot that the ticket is assigned to. | | `departmentAssigneeId` | guid | body | no | Id of department that the ticket is assigned to. | | `channelId` | string | body | yes | Id of the channel of the first message of the ticket. | | `channelAccountId` | guid | body | no | Id of the channel account of the first message of the ticket. | | `contactOrVisitorId` | guid | body | yes | Id of the contact or visitor that the ticket related to. | | `createdById` | guid | body | no | Id of role(contact, visitor, chatbot, channelAccount, system, agent) who created the ticket. | | `assigneeType` | string | body | no | Type of the ticket assignee. Allowed values are "agent", "chatbot". | | `contactOrVisitorType` | string | body | no | Type of the ticket contact. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `status` | string | body | no | Status of the ticket. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `priority` | string | body | no | Priority of the ticket. Allowed values are "urgent", "high", "normal", "low". | | `createdByType` | string | body | no | Who created the ticket. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `messages` | [messages[]](/docs/ticketingmessage) | body | no | The list of ticket messages. | | `tagIds` | array | body | no | The list of tag which belongs to the ticket. | - #### Response: [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"subject":"Chat Transcript with Michael","originalConversationId":"110778970771178_202317311617343","assigneeId":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","departmentAssigneeId":"91B032D9-0D07-4798-95F7-7EA482BC592C","channelId":"F9B07E54-0D35-4F53-BA63-1194E4297291","channelAccountId":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","contactOrVisitorId":"E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4","createdById":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","assigneeType":"agent","contactOrVisitorType":"contact","status":"new","priority":"normal","createdByType":"contact","lastMessage":{"parentId":"ef50cc68-5b88-4405-88f0-84334581246d","sentById":"31cb8d70-b5a6-4faa-b021-62335d6dcf6c","sentByType":"visitor","time":"2021-04-26T10:52:24.336Z","type":"text","metadata":{"channel":{"channelAccount":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","isFromChannelToPlatform":true},"source":{"contactIdentityId":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","conversationId":"1848"},"decoration":{"chat":{"title":"Chat Transcript with 1"},"offlineMessage":{"title":"Chat Transcript with 1"}}},"originalId":"96e7964a-29cb-40d6-8251-4f334b5748bd","channelId":"Email","body":"data:text/plain;base64,PHA+MTExPC9wPg==","ifDisplayInTicketCorrespondences":true,"messageDelivery":{"status":"failed","failReason":"something is wrong.","time":"2021-04-26T10:52:24.336Z","groupId":"8c0136f3-9dd3-47f3-be12-81b232c84408","orderNum":0},"attachments":[{"fileKey":"isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7","name":"my file","size":10,"type":"file","url":"http://myfile/url"}]},"messages":[{"parentId":"ef50cc68-5b88-4405-88f0-84334581246d","sentById":"31cb8d70-b5a6-4faa-b021-62335d6dcf6c","sentByType":"visitor","time":"2021-04-26T10:52:24.336Z","type":"text","metadata":{"channel":{"channelAccount":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","isFromChannelToPlatform":true},"source":{"contactIdentityId":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","conversationId":"1848"},"decoration":{"chat":{"title":"Chat Transcript with 1"},"offlineMessage":{"title":"Chat Transcript with 1"}}},"originalId":"96e7964a-29cb-40d6-8251-4f334b5748bd","channelId":"Email","body":"data:text/plain;base64,PHA+MTExPC9wPg==","ifDisplayInTicketCorrespondences":true,"messageDelivery":{"status":"failed","failReason":"something is wrong.","time":"2021-04-26T10:52:24.336Z","groupId":"8c0136f3-9dd3-47f3-be12-81b232c84408","orderNum":0},"attachments":[{"fileKey":"isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7","name":"my file","size":10,"type":"file","url":"http://myfile/url"}]}]}' ``` Response: HTTP/1.1 201 Created ``` { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": false, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Merge ticket `POST ticketing/tickets/{id}:merge` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `sourceId` | integer | body | yes | Id of the ticket that will be merged. | - #### Response: No Content - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets{1732}:merge \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"sourceId": "9527"}' ``` Response: HTTP/1.1 200 OK ### Read the Ticket `POST ticketing/tickets/{id}:read` - #### Parameters: No Parameters - #### Response: [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11:read \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": true, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Recycle the ticket. `POST ticketing/tickets/{id}:recycle` - #### Parameters: No Parameters - #### Response: No Content - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11:recycle \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ ``` Response: HTTP/1.1 200 OK ### Unread the Ticket `POST ticketing/tickets/{id}:unread` - #### Parameters: No Parameters - #### Response: [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11:unread \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": false, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Get unread count of the ticket. `POST ticketing/tickets:unreadCount` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `viewIds` | guid[] | body | no | The list of view id. | - #### Response: | Name | Type | Description | | --- | --- | --- | | `allCount` | integer | All unread count. | | `unreadCounts` | array | The list of unread count info for each view. | | `unreadCounts[].mentionedUnReadCount` | integer | Unread count for mentioned ticket. | | `unreadCounts[].mentionedUnReadTicketIds` | selfIncrementId[] | The list of id of the mentioned ticket which is unread. | | `unreadCounts[].unreadCount` | integer | Unread count for the view. | | `unreadCounts[].unreadTicketIds` | selfIncrementId[] | The list of id of the ticket which is unread. | | `unreadCounts[].viewId` | guid | Id of the view. | - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets:unreadCount \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"viewIds": ["f1ab6333-4260-eb11-aacf-06c7a219a2ac"]}' ``` Response: HTTP/1.1 200 OK ``` { "allCount": 145, "unreadCounts": [ { "viewId": "f1ab6333-4260-eb11-aacf-06c7a219a2ac", "unreadTicketIds": [ 1994, 1875 ], "unreadCount": 145, "mentionedUnReadTicketIds": [], "mentionedUnReadCount": 0 } ] } ``` ### Update the Ticket `PUT ticketing/tickets/{id}` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `subject` | string | body | yes | Subject of the ticket. | | `originalConversationId` | string | body | no | Conversion Id in original channel. | | `assigneeId` | guid | body | no | Id of agent or chatbot that the ticket is assigned to. | | `departmentAssigneeId` | guid | body | no | Id of department that the ticket is assigned to. | | `channelId` | string | body | yes | Id of the channel of the first message of the ticket. | | `channelAccountId` | guid | body | no | Id of the channel account of the first message of the ticket. | | `contactOrVisitorId` | guid | body | yes | Id of the contact or visitor that the ticket related to. | | `createdById` | guid | body | no | Id of role(contact, visitor, chatbot, channelAccount, system, agent) who created the ticket. | | `assigneeType` | string | body | no | Type of the ticket assignee. Allowed values are "agent", "chatbot". | | `contactOrVisitorType` | string | body | no | Type of the ticket contact. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `status` | string | body | no | Status of the ticket. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `priority` | string | body | no | Priority of the ticket. Allowed values are "urgent", "high", "normal", "low". | | `createdByType` | string | body | no | Who created the ticket. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent". | | `isReadByAgent` | bool | body | no | Whether the ticket is read by any agent or not. | | `isInRecycleBin` | bool | body | no | Whether the ticket is in recyle bin or not. | | `messages` | [messages[]](/docs/ticketingmessage) | body | no | The list of ticket messages. | | `tagIds` | array | body | no | The list of tag which belongs to the ticket. | - #### Response: [Ticket](/docs/server-api-ticketing-ticket#ticket-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11 \ -X 'PUT' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"subject":"Chat Transcript with Michael","originalConversationId":"110778970771178_202317311617343","assigneeId":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","departmentAssigneeId":"91B032D9-0D07-4798-95F7-7EA482BC592C","channelId":"F9B07E54-0D35-4F53-BA63-1194E4297291","channelAccountId":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","contactOrVisitorId":"E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4","createdById":"1487fc9d-92e6-4487-a2e8-92e68d6892e6","assigneeType":"agent","contactOrVisitorType":"contact","status":"new","priority":"normal","createdByType":"contact","lastMessage":{"parentId":"ef50cc68-5b88-4405-88f0-84334581246d","sentById":"31cb8d70-b5a6-4faa-b021-62335d6dcf6c","sentByType":"visitor","time":"2021-04-26T10:52:24.336Z","type":"text","metadata":{"channel":{"channelAccount":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","isFromChannelToPlatform":true},"source":{"contactIdentityId":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","conversationId":"1848"},"decoration":{"chat":{"title":"Chat Transcript with 1"},"offlineMessage":{"title":"Chat Transcript with 1"}}},"originalId":"96e7964a-29cb-40d6-8251-4f334b5748bd","channelId":"Email","body":"data:text/plain;base64,PHA+MTExPC9wPg==","ifDisplayInTicketCorrespondences":true,"messageDelivery":{"status":"failed","failReason":"something is wrong.","time":"2021-04-26T10:52:24.336Z","groupId":"8c0136f3-9dd3-47f3-be12-81b232c84408","orderNum":0},"attachments":[{"fileKey":"isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7","name":"my file","size":10,"type":"file","url":"http://myfile/url"}]},"messages":[{"parentId":"ef50cc68-5b88-4405-88f0-84334581246d","sentById":"31cb8d70-b5a6-4faa-b021-62335d6dcf6c","sentByType":"visitor","time":"2021-04-26T10:52:24.336Z","type":"text","metadata":{"channel":{"channelAccount":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","isFromChannelToPlatform":true},"source":{"contactIdentityId":"b293de41-e8a5-46b5-98dc-f8db9e5e6518","conversationId":"1848"},"decoration":{"chat":{"title":"Chat Transcript with 1"},"offlineMessage":{"title":"Chat Transcript with 1"}}},"originalId":"96e7964a-29cb-40d6-8251-4f334b5748bd","channelId":"Email","body":"data:text/plain;base64,PHA+MTExPC9wPg==","ifDisplayInTicketCorrespondences":true,"messageDelivery":{"status":"failed","failReason":"something is wrong.","time":"2021-04-26T10:52:24.336Z","groupId":"8c0136f3-9dd3-47f3-be12-81b232c84408","orderNum":0},"attachments":[{"fileKey":"isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7","name":"my file","size":10,"type":"file","url":"http://myfile/url"}]}]}' ``` Response: HTTP/1.1 200 OK ``` { "id": 11, "subject": "Chat Transcript with Michael", "originalConversationId": "110778970771178_202317311617343", "assigneeId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "departmentAssigneeId": "91B032D9-0D07-4798-95F7-7EA482BC592C", "channelId": "F9B07E54-0D35-4F53-BA63-1194E4297291", "channelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastMessageChannelId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE3", "lastMessageChannelAccountId": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "contactOrVisitorId": "E23B5D3C-4E7E-4131-9B3A-52B061BA7DE4", "createdById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "lastRepliedById": "93AD44C8-CB30-40E1-8941-B693BAE74455", "resolvedById": "1487fc9d-92e6-4487-a2e8-92e68d6892e6", "assigneeType": "agent", "contactOrVisitorType": "contact", "status": "new", "priority": "normal", "createdByType": "contact", "lastRepliedByType": "agent", "resolvedByType": "agent", "isReadByAgent": false, "isReadByContact": false, "ifHasDraft": false, "mergedToTargetId": 89, "totalReplies": 4, "createdTime": "2021-05-12T08:10:53.48Z", "lastUpdatedTime": "2021-04-07T05:59:17.887Z", "lastRepliedTime": "2021-05-12T08:10:53.486Z", "lastStatusChangedTime": "2021-05-12T08:10:53.486Z", "resolvedTime": "2021-05-12T08:10:53.486Z", "isInRecycleBin": false, "reopenedTime": "2021-04-07T05:59:17.887Z", "responseTimeSpan": 50, "replyingAgent": "", "responseCount": 3, "resolvedTimeSpan": 2517872, "firstResponseTimeSpan": 127, "tags": [ { "id": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "name": "my tag" } ], "draft": { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] }, "noteMentions": [ { "isReadByAgent": false, "noteId": "4d103607-f113-4884-8f7e-735f6fefdbf9", "id": "277ed089-94de-4751-926e-bcae2fde95d4", "agentId": "bdf96bad-890f-4af5-8f4e-42d2cc29e61b", "ticketId": "11" } ], "tagIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Remove the Ticket `DELETE ticketing/tickets/{id}` - #### Parameters: No Parameters - #### Response: No Content - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11 \ -X 'DELETE' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 204 No Content