Message
  • 31 Aug 2022
  • 7 Minutes to read
  • Dark
    Light

Message

  • Dark
    Light

Article summary

Message

Message of the ticket.

Message JSON Format

Message is represented as simple flat JSON objects with the following keys:

NameTypeDescription
idguidId of the message.
ticketIdintId of the ticket which the message belongs to.
parentIdguidId of current message's parent.
sentByIdguidId of the message sender.
sentByTypestringRole of the sender. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent".
timedatetimeTime when the message was created.
typestringType of message content. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView".
metadataobjectMessage metadata, Json format.
originalIdstringId in original channel.
channelIdstringName of the message channel.
bodystringContent of the message. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content.
ifDisplayInTicketCorrespondencesboolWhether a trigger email should be included within a ticket's correspondence thread or not.
attachmentsattachments[]Reference to MessageAttachment.
messageDeliverymessageDeliveryReference to MessageDelivery.

MessageDelivery JSON Format:

NameTypeDescription
messageIdguidId of the message which the delivery belongs to.
statusstringStatus of the delivery. Allowed values are "waitForSending", "sending", "failed", "success".
failReasonstringReason why the delivery failed.
timedatetimeTime when message was delivered.
groupIdguidThe Id of the message group, it is used for bot message, it should be delivered in a group and one by one in order.
orderNumintegerOrder of the delivery.

MessageAttachment JSON Format:

NameTypeDescription
idguidId of the attachment.
messageIdguidId of the message which the attachment belongs to.
fileKeystringUnique key in file service.
namestringName of the attachment.
sizeintegerSize of the attachment.
typestringType of the attachment. Allowed values are "video", "audio", "image", "file".
urlstringDownload URL of the attachment.

Get a single Message

GET ticketing/messages/{id}

  • Parameters:

NameTypeinRequiredDescription
includestringquerynoAllowed values are "ticketingMessageAttachment", "ticketingMessageDelivery", "sentBy".
  • Response:

Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages/3b6560d4-0f10-4652-a376-e590936d290e \ 
    -X 'GET' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 200 OK

{
  "id": "3b6560d4-0f10-4652-a376-e590936d290e",
  "ticketId": "100",
  "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,
  "attachments": [
      {
          "id": "8c0136f3-9dd3-47f3-be12-81b232c84408",
          "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
          "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7",
          "name": "my file",
          "size": 10,
          "type": "file",
          "url": "http://myfile/url"
      }
  ],
  "messageDelivery": {
      "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
      "status": "failed",
      "failReason": "something is wrong.",
      "time": "2021-04-26T10:52:24.336Z",
      "groupId": "8c0136f3-9dd3-47f3-be12-81b232c84408",
      "orderNum": 0
  }
} 

Get the list of Message

GET ticketing/tickets/{id}/messages

  • Parameters:

NameTypeinRequiredDescription
ticketIdselfIncrementIdqueryyesFilter by ticket id.
notSentByIdguidquerynoFilter by sender.
includestringquerynoAllowed values are "ticketingMessageAttachment", "ticketingMessageDelivery", "sentBy".
  • Response:

An array of Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/tickets/3b6560d4-0f10-4652-a376-e590936d290e/messages \ 
    -X 'GET' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 200 OK

[
  {
      "id": "3b6560d4-0f10-4652-a376-e590936d290e",
      "ticketId": "100",
      "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,
      "attachments": [
          {
              "id": "8c0136f3-9dd3-47f3-be12-81b232c84408",
              "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
              "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7",
              "name": "my file",
              "size": 10,
              "type": "file",
              "url": "http://myfile/url"
          }
      ],
      "messageDelivery": {
          "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
          "status": "failed",
          "failReason": "something is wrong.",
          "time": "2021-04-26T10:52:24.336Z",
          "groupId": "8c0136f3-9dd3-47f3-be12-81b232c84408",
          "orderNum": 0
      }
  }
] 

Create a new Message

POST ticketing/messages

  • Parameters:

NameTypeinRequiredDescription
ticketIdintbodyyesAuto Increment Id of the ticket which the message belongs to.
parentIdguidbodynoId of current message's parent.
sentByIdguidbodyyesId of the message sender.
sentByTypestringbodyyesRole of the sender. Allowed values are "contact", "visitor", "chatbot", "channelAccount", "system", "agent".
timedatetimebodynoTime when the message was created.
typestringbodyyesType of message content. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView".
metadataobjectbodyyesMessage metadata, Json format.
originalIdstringbodynoId in original channel.
channelIdstringbodyyesName of the message channel.
bodystringbodynoContent of the message. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content.
ifDisplayInTicketCorrespondencesboolbodynoWhether a trigger email should be included within a ticket's correspondence thread or not.
messageDeliverymessageDeliverybodynoDelivery information of the message.
attachmentsattachments[]bodynoThe list of message attachment.
  • Response:

Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"ticketId":"100","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": "3b6560d4-0f10-4652-a376-e590936d290e",
  "ticketId": "100",
  "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,
  "attachments": [
      {
          "id": "8c0136f3-9dd3-47f3-be12-81b232c84408",
          "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
          "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7",
          "name": "my file",
          "size": 10,
          "type": "file",
          "url": "http://myfile/url"
      }
  ],
  "messageDelivery": {
      "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
      "status": "failed",
      "failReason": "something is wrong.",
      "time": "2021-04-26T10:52:24.336Z",
      "groupId": "8c0136f3-9dd3-47f3-be12-81b232c84408",
      "orderNum": 0
  }
} 

Send bot intent.

POST ticketing/messages/{id}:botIntent

  • Parameters:

NameTypeinRequiredDescription
botIdguidbodyyesId of the bot.
channelIdstringbodyyesId of the channel.
intentIdguidbodyyesId of the intent.
metadatajsonbodyyesMessage metadata, Json format.
  • Response:

No Content

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages/11:botIntent \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{
  "botId": "af2aee4e-ec78-42d2-9360-292672591586",
  "channelId": "FacebookMessenger",
  "intentId": "5380b2d2-eb96-4b9a-a959-68b77764e9ac",
  "metadata": {
    "channel": {
      "accountName": "my space",
      "channelAccount": "92920f2f-01c0-4151-bd7c-c0f9bf8c565b"
    },
    "source": {
      "name": "Yu",
      "contactIdentityId": "cace9f1f-40f7-4f62-adc9-987eb121392a"
    }
  }
}
' 

Response:

HTTP/1.1 200 OK

Resend the Message

POST ticketing/messages/{id}:resend

  • Parameters:

No Parameters

  • Response:

Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages/3b6560d4-0f10-4652-a376-e590936d290e:resend \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 200 OK

{
  "id": "3b6560d4-0f10-4652-a376-e590936d290e",
  "ticketId": "100",
  "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,
  "attachments": [
      {
          "id": "8c0136f3-9dd3-47f3-be12-81b232c84408",
          "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
          "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7",
          "name": "my file",
          "size": 10,
          "type": "file",
          "url": "http://myfile/url"
      }
  ],
  "messageDelivery": {
      "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
      "status": "failed",
      "failReason": "something is wrong.",
      "time": "2021-04-26T10:52:24.336Z",
      "groupId": "8c0136f3-9dd3-47f3-be12-81b232c84408",
      "orderNum": 0
  }
} 

Identify message

POST ticketing/messages:identify

  • Parameters:

NameTypeinRequiredDescription
originalIdstringbodyyesOriginal Id of message.
channelIdstringbodyyesChannel Id of message.
  • Response:

Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages:identify \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"originalId":"7bf5bad7-dee7-438a-a943-bdb3fbcf376f","channelId":"email"}' 

Response:

HTTP/1.1 200 OK

{
  "id": "a92ba29a-722b-48f6-9038-7e3ed2059b99",
  "ticketId": 2860,
  "parentId": "00000000-0000-0000-0000-000000000000",
  "sentById": "902f53f4-4acc-4103-8e85-fd20e7678edd",
  "sentByType": 3,
  "time": "2021-05-08T13:12:49.88Z",
  "body": "message content",
  "type": 2,
  "metadata": {
      "channel": {
          "channelAccount": "bed5c210-e6ae-eb11-8105-00155d081d0b",
          "isFromChannelToPlatform": true,
          "accountName": "frank@comm100.com"
      },
      "source": {
          "authorId": "frank@comm100.com",
          "messageUrl": "",
          "name": "frank@comm100.com",
          "contactIdentityId": "066ddbb7-6009-47f2-8f45-00241bbbf018",
          "conversationId": ""
      },
      "decoration": {
          "email": {
              "from": "frank@comm100.com",
              "to": "test4@comm100.com",
              "cc": "",
              "bcc": "",
              "subject": "111",
              "quote": "",
              "ifHasAttachmentNotReceived": false
          }
      }
  },
  "originalId": "7bf5bad7-dee7-438a-a943-bdb3fbcf376f",
  "channelId": "Email",
  "attachments": [],
  "sentBy": {},
  "ifDisplayInTicketCorrespondences": true
} 

Update the Message

PUT ticketing/messages/{id}

  • Parameters:

NameTypeinRequiredDescription
metadataobjectbodyyesMessage metadata, Json format.
originalIdstringbodynoId in original channel.
messageDeliverymessageDeliverybodynoDelivery information of the message.
  • Response:

Message

  • Example

Sample Request:

curl https://api11.comm100.io/v4/ticketing/messages/3b6560d4-0f10-4652-a376-e590936d290e \ 
    -X 'PUT' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"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","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": "3b6560d4-0f10-4652-a376-e590936d290e",
  "ticketId": "100",
  "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,
  "attachments": [
      {
          "id": "8c0136f3-9dd3-47f3-be12-81b232c84408",
          "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
          "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7",
          "name": "my file",
          "size": 10,
          "type": "file",
          "url": "http://myfile/url"
      }
  ],
  "messageDelivery": {
      "messageId": "3b6560d4-0f10-4652-a376-e590936d290e",
      "status": "failed",
      "failReason": "something is wrong.",
      "time": "2021-04-26T10:52:24.336Z",
      "groupId": "8c0136f3-9dd3-47f3-be12-81b232c84408",
      "orderNum": 0
  }
} 

Was this article helpful?

What's Next