Set the draft reply for a chat
PUT
/openapi/chat/draft/{chatId}
const url = 'https://open-api.replyco.com/openapi/chat/draft/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'}, body: '{ "messageText": "Yes, until it ships. Which address should we use?" }'};
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/chat/draft/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json-patch+json' \ --data '{ "messageText": "Yes, until it ships. Which address should we use?" }'Saves a draft reply on the live chat. Agents see it pre-filled in the message box the next time they open the chat, and agents who already have the chat open see it straight away. The draft is not sent to the customer.
Notes:
- MessageText is plain text
- A chat has one draft shared by all agents, so this replaces any existing draft
- Send null or an empty MessageText to clear the draft
- The draft is cleared when a message is sent, and expires after 24 hours
Sample request:
PUT /chat/draft/3fa85f64-5717-4562-b3fc-2c963f66afa6
{
"messageText": "Hi John, your order has been shipped."
}
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”chatId
required
string format: uuid
Chat ID to set the draft for
Request Body
Section titled “Request Body”Request containing the draft text
object
messageText
The draft reply as plain text. Use null or an empty string to clear the draft.
string
Example
{ "messageText": "Yes, until it ships. Which address should we use?"}object
messageText
The draft reply as plain text. Use null or an empty string to clear the draft.
string
Example generated
{ "messageText": "example"}object
messageText
The draft reply as plain text. Use null or an empty string to clear the draft.
string
Example generated
{ "messageText": "example"}object
messageText
The draft reply as plain text. Use null or an empty string to clear the draft.
string
Example generated
{ "messageText": "example"}Responses
Section titled “Responses”Draft was saved or cleared
Invalid request body
User is not authenticated or authorized
Chat with the specified ID was not found