Ticket Messages

Create a message

Changed on

Create a message and either:

  • not send it if the attribute sent_datetime is filled. If you import a message that was already sent, make sure to set this value.
  • send it to the recipients if the attribute sent_datetime is empty.
  • add it to the ticket as an internal note if you specified this channel. Internal notes are not sent to your customers.

When a message is created, it does not mean that this one has been sent because the creation and sending process are decoupled. Messages are basically sent asynchronously. Once a message has been sent, Gorgias will automatically update the message to fill the time when it was sent (sent_datetime).

post/api/tickets/{ticket_id}/messages

Request

Path parameters

ticket_idinteger required

The ID of the ticket to create a message in.

Query parameters

action'force' | 'retry' | 'cancel'
Example:force

Policy applied on external actions associated with the message if they failed. Three actions are possible:

  • force: bypass the failed action and try to execute the remaining one and to send the message
  • retry: retry the failed action
  • cancel: delete the TicketMessage

Headers

If-Unmodified-Sincestring
Example:Sun, 01 Sep 2024 00:00:00 GMT

An HTTP-date precondition for message creation. For a merged source ticket, this returns ticket_merged only when the ticket was merged after the supplied time, compared at one-second resolution. Invalid dates are ignored. A satisfied or ignored condition does not make a merged ticket available, so normal 404 behavior still applies.

Request body

body_htmlstring

HTML version of the body of the message

body_textstring

Text version of the body of the message

created_datetimestring date-time

When the message was created

deleted_datetimestring date-time

When the message was deleted

external_idstring

ID of the message in a foreign system (Aircall, Zendesk, etc...). This field is not used by Gorgias, feel free to set it as you wish.

failed_datetimestring date-time

When the message failed to be sent. Messages that couldn't be sent can be resent.

from_agentboolean required

Whether the message was sent by your company

headersobject

Headers of the message

integration_idinteger

ID of the Integration used to send the message

message_idstring

ID of the message on the service that sent the message. It can be the ID of an email, a Messenger message, a Facebook comment, etc...

opened_datetimestring date-time

When the message was seen by its recipient

publicboolean

Whether the message is public. Only internal notes are private.

sent_datetimestring date-time

When the message was sent. If omitted, the message will be sent by Gorgias.

stripped_htmlstring

HTML version of the body of the message without email signatures and previous replies.

stripped_signaturestring

Signature stripped from the body of the message

stripped_textstring

Text version of the body of the message without email signatures and previous replies.

subjectstring

Subject of the message

via'aircall' | 'api' | 'chat' | 'contact_form' | 'email' | 'facebook' | 'facebook-mention' | 'facebook-messenger' | 'facebook-recommendations' | 'form' | 'helpdesk' | 'help-center' | 'instagram' | 'instagram-ad-comment' | 'instagram-comment' | 'instagram-direct-message' | 'instagram-mention' | 'internal-note' | 'phone' | 'rule' | 'shopify' | 'sms' | 'twilio' | 'twitter' | 'twitter-direct-message' | 'whatsapp' | 'yotpo' | 'yotpo-review' | 'zendesk'

How the message has been received or sent from Gorgias

importedboolean

Whether the message was created by a historical import.

mention_idsinteger[]

List of User IDs to mention along with the internal note.

Response

The created message.

idinteger required

ID of the message.

uristring required

URI of the message.

message_idstring required

ID of the message on the service that sent the message.It can be the ID of an email, a Messenger message, a Facebook comment, etc...

ticket_idinteger required

The ID of the ticket the message is associated with.

external_idstring required

ID of the message in a foreign system (Aircall, Zendesk, etc...). This field is not used by Gorgias, feel free to set it as you wish.

publicboolean

Whether the message was sent/receive by a customer. Internal notes are not public.

via'aircall' | 'api' | 'chat' | 'contact_form' | 'email' | 'facebook' | 'facebook-mention' | 'facebook-messenger' | 'facebook-recommendations' | 'form' | 'gorgias_chat' | 'help-center' | 'helpdesk' | 'instagram' | 'instagram-ad-comment' | 'instagram-comment' | 'instagram-direct-message' | 'instagram-mention' | 'internal-note' | 'offline_capture' | 'phone' | 'rule' | 'self_service' | 'shopify' | 'sms' | 'twilio' | 'twitter' | 'twitter-direct-message' | 'whatsapp' | 'yotpo' | 'yotpo-review' | 'zendesk' required
integration_idinteger required

ID of the integration that either received or sent the message.

rule_idinteger required

ID of the rule which sent the message, if any.

from_agentboolean required

Whether the message was sent by your company to a customer, or the opposite.

subjectstring required

The subject of the message.

body_textstring required

The full text version of the body of the message, if any.

body_htmlstring required

The full HTML version of the body of the message, if any.

body_urlstring required

The URL to download the archived body of the email message. Empty until the body is archived, 30 days after it was sent or received. Only applies to email messages that have stripped bodies.

stripped_textstring required

The text version of the body of the message without email signatures and previous replies.

stripped_htmlstring required

The HTML version of the body of the message without email signatures and previous replies.

stripped_signaturestring required
actionsobject[] required

A list of actions executed before the message was sent. These actions are set by macros.

headersobject

Message headers. Used for email messages.

importedboolean required

Whether the message was created by a historical import.

metaunknown required
created_datetimestring date-time required

When the message was created.

processed_datetimestring date-time required

When the message was processed by Gorgias. Differs from created_datetime which refers to the external service.

deleted_datetimestring date-time

When the message was deleted.

sent_datetimestring date-time required

When the message was sent. If omitted, the message will be sent by Gorgias.

failed_datetimestring date-time required

When the message failed to be sent. Messages that couldn't be sent can be resend.

opened_datetimestring date-time required

When the message was opened by the primary receiver.

is_retriableboolean required

It determines if the message can be retried or not.

Example response

{
  "id": 924712,
  "message_id": "<123345676453.2445.234@web>",
  "ticket_id": 12,
  "external_id": "MSG-78545",
  "public": true,
  "integration_id": 28643,
  "intents": [
    {
      "name": "discount/request"
    }
  ],
  "rule_id": 89465,
  "from_agent": true,
  "subject": "Re:Refund request",
  "body_text": "Hello,\n\n        I can't place an order on your site, it says: I don't have enough credit.\n        How can I add some credits?\n\n        Cheers,\n        John Doe\n        ",
  "body_html": "Hello,<br><br>\n\n            I can't place an order on your site, it says: I don't have enough credit.<br>\n            How can I add some credits?<br><br>\n\n            Cheers,<br>\n            John Doe\n            ",
  "attachments": [],
  "macros": [],
  "actions": [],
  "headers": {
    "My-Header": "foo"
  },
  "meta": {},
  "created_datetime": "2020-01-27T10:42:21.468912",
  "processed_datetime": "2020-01-27T10:42:21.468912",
  "deleted_datetime": "2020-01-27T10:42:21.468912",
  "opened_datetime": "2019-07-05T15:22:46.472436",
  "replied_by": {
    "integration_id": 28643,
    "created_datetime": "2020-01-27T10:42:21.468912",
    "body_text": "Hello,\n\n        I can't place an order on your site, it says: I don't have enough credit.\n        How can I add some credits?\n\n        Cheers,\n        John Doe\n        "
  },
  "replied_to": {
    "integration_id": 28643,
    "created_datetime": "2020-01-27T10:42:21.468912",
    "body_text": "Hello,\n\n        I can't place an order on your site, it says: I don't have enough credit.\n        How can I add some credits?\n\n        Cheers,\n        John Doe\n        "
  }
}

Changes

    • info

      added the new optional header request parameter If-Unmodified-Since

    • info

      added the non-success response with the status

    • info

      added the required property to the response with the status