Set the draft reply for a thread
const url = 'https://open-api.replyco.com/openapi/thread/draft/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'}, body: '{ "text": "Hi Jane,\n\nThanks for the photo. We have sent a replacement today." }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://open-api.replyco.com/openapi/thread/draft/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json-patch+json' \ --data '{ "text": "Hi Jane,\n\nThanks for the photo. We have sent a replacement today." }'Saves a draft reply on the thread. Agents see it pre-filled in the reply editor the next time they open the thread, and agents who already have the thread open see it straight away. The draft is not sent to the customer.
Draft content - send one of:
htmlBody- HTML, sanitized the same way as a sent messagetext- plain text, converted to HTML. Line breaks are kept and blank lines start a new paragraph
If both are sent, htmlBody is used and text is ignored.
Notes:
- A thread has one draft shared by all agents, so this replaces any existing draft
- Send both fields null or empty to clear the draft
- The draft is cleared when a reply is sent, and expires after 24 hours
Sample request with HTML:
PUT /thread/draft/3fa85f64-5717-4562-b3fc-2c963f66afa6
{
"htmlBody": "<p>Hi John, your order has been shipped.</p>"
}
Sample request with plain text:
PUT /thread/draft/3fa85f64-5717-4562-b3fc-2c963f66afa6
{
"text": "Hi John,\n\nYour order has been shipped."
}
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Thread ID to set the draft for
Request Body
Section titled “Request Body”Request containing the draft as HTML or plain text
object
The draft reply as HTML. Takes priority over Text when both are sent.
The draft reply as plain text. Converted to HTML, with line breaks and paragraphs kept. Used when HtmlBody is empty.
Example
{ "text": "Hi Jane,\n\nThanks for the photo. We have sent a replacement today."}object
The draft reply as HTML. Takes priority over Text when both are sent.
The draft reply as plain text. Converted to HTML, with line breaks and paragraphs kept. Used when HtmlBody is empty.
Example generated
{ "htmlBody": "example", "text": "example"}object
The draft reply as HTML. Takes priority over Text when both are sent.
The draft reply as plain text. Converted to HTML, with line breaks and paragraphs kept. Used when HtmlBody is empty.
Example generated
{ "htmlBody": "example", "text": "example"}object
The draft reply as HTML. Takes priority over Text when both are sent.
The draft reply as plain text. Converted to HTML, with line breaks and paragraphs kept. Used when HtmlBody is empty.
Example generated
{ "htmlBody": "example", "text": "example"}Responses
Section titled “Responses”Draft was saved or cleared
Invalid request body
User is not authenticated or authorized
Thread with the specified ID was not found