v1

latestOpenAPI 3.1.02026-07-24111290748.0 KB
Ticket Messages

Create a message

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

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

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.

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.

{"stackTrail":"components:schemas:TicketMessage:properties:meta","oasType":"schema","type":"unknown","title":"meta","description":"Metadata associated with the message.\n\nYou can use this field to store structured information (key-value data) about the message.\n\nReserved keys:\n\n- `current_page`: The page from where the user is currently chatting.\n- `relevant_content_indexes`: Indexes containing relevant text of the message.\n- `is_quick_reply`: Whether the message is a \"quick reply\".\n- `campaigns`: ID of the chat campaign the message is replying to.\n- `campaigns_id`: ID of the chat campaign that sent this message.\n- `self_service_flow`: An object containing metadata of the self-service flow associated to the message.\n","example":{}}
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        "
  }
}