Skip to content

Send a new message to a thread

POST
/openapi/message/send
curl --request POST \
--url https://open-api.replyco.com/openapi/message/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '{ "threadId": "7d2e9b14-5c3a-4f61-9a8e-2b6c0d4e1f37", "htmlBody": "<p>Hi Jane,</p><p>We have sent a replacement today.</p>", "text": "Hi Jane,\n\nWe have sent a replacement today.", "closeAfterSend": false }'

Sends a new message to an existing thread/ticket.

Required fields:

  • threadId
  • accountId
  • htmlBody (or attachments)

Optional fields:

  • text (plain text version of the message, required for eBay - see below)
  • attachments
  • languageCode
  • closeAfterSend, archiveAfterSend
  • isDelayed with sendingDate (schedule the message instead of sending it now)
  • messageDate

Plain text integrations (eBay):

Some integrations do not accept HTML. For tickets on an eBay integration the message content must be sent in text as plain text instead of htmlBody, otherwise the request is rejected with 400. eBay also limits a reply to 4000 characters. For all other integrations htmlBody is used, and sending text alongside it is still recommended so the plain text version matches your formatting.

Attachments:

Each attachment needs a fileName including its extension, plus one of:

  • data - the base64 encoded content of a new file. This is the normal way to upload.
  • url - a path returned by an earlier Replyco response, to re-use a file that is already stored. External addresses are not downloaded and will not produce a working attachment.

Limits depend on the integration the ticket belongs to. Files are rejected with 400 when a limit is exceeded, and executable file types are always rejected:

Integration File types Per file Per message Max files
eBay jpg, jpeg, png, gif, bmp, tif, tiff (pdf only when the file converter is enabled for your user) 12 MB - 5
eBay REST any non-executable type 10 MB 25 MB 5
Amazon any non-executable type 10 MB 6 MB -
Cdiscount any non-executable type 10 MB 4 MB 3
all others any non-executable type 10 MB 25 MB -

eBay additionally rejects an image whose width plus height is more than 12000 pixels. Size limits only apply to files sent as data; there is no size to check for an attachment referenced by url, though its file type is still validated.

Sample request:

POST /message/send
{
  "threadId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "accountId": "8a1b1d6c-5f1a-4c8e-9f2b-7d3e5a9c1b40",
  "htmlBody": "Thank you for contacting us.",
  "text": "Thank you for contacting us.",
  "attachments": [
    {
      "fileName": "invoice.pdf",
      "data": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PC9MZW5ndGg..."
    }
  ]
}

Sample request for a ticket on an eBay integration:

POST /message/send
{
  "threadId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "accountId": "8a1b1d6c-5f1a-4c8e-9f2b-7d3e5a9c1b40",
  "text": "Thank you for contacting us.",
  "attachments": []
}

Message details including thread ID, content, and options

object
threadId

The ID of the thread/ticket to add this message to

string format: uuid
accountId

The ID of the account/integration this message is associated with

string format: uuid
isDelayed

Whether this message should be scheduled for later sending instead of being sent immediately. Default is false

boolean
messageDate

The date and time when the message was originally created or received

string format: date-time
nullable
sendingDate

The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true

string format: date-time
nullable
htmlBody

The HTML content of the message. This can include formatting, links, and embedded images

string
nullable
text

The plain text content of the message without HTML formatting

string
nullable
closeAfterSend

Whether to automatically close(resolve) the ticket after this message is sent. Default is false

boolean
archiveAfterSend

Whether to automatically archive the ticket after this message is sent. Default is false

boolean
attachments

List of file attachments to include with this message. Can be empty if no attachments are needed

Array<object>
nullable
object
url

Path of a file already stored by Replyco, exactly as returned by a previous API response. Provide either ‘url’ or ‘data’ for each attachment. A URL is stored as given and is never downloaded, so an external address will not produce a working attachment

string
nullable
fileName

Required. The name of the file including its extension (e.g., “invoice.pdf”, “image.jpg”). The extension decides whether the integration accepts the file, so it must be present

string
nullable
data

Base64 encoded content of a new file to upload. Provide either ‘data’ or ‘url’. Size and file type limits apply and depend on the integration the ticket belongs to

string format: byte
nullable
fileFormat
string
nullable
mimeType
string
nullable
languageCode

The language code of the message content (e.g., “en”, “es”, “fr”). Used for translation and localization

string
nullable

Example

{
"threadId": "7d2e9b14-5c3a-4f61-9a8e-2b6c0d4e1f37",
"htmlBody": "<p>Hi Jane,</p><p>We have sent a replacement today.</p>",
"text": "Hi Jane,\n\nWe have sent a replacement today.",
"closeAfterSend": false
}

Message was sent successfully

Invalid request - missing required fields, invalid thread, or an attachment that is too large, of a file type the integration does not accept, or missing its file name. The response body carries the reason in its ‘error’ field

User is not authenticated or authorized

User does not have permission to send messages to this thread

Thread with the specified ID was not found