How to reply to customers via API?

Markdown

View as Markdown

The reply endpoints send a real email to your customer. This article covers the safe workflow: stage a draft, preview exactly what will be sent with a dry run, then send.

Please Note

A reply emails the customer — an external side effect with no undo. Anything meant for your team belongs in the discussion instead (see participating in discussions). The two use separate scopes on purpose: conversation.reply for sending, conversation.write for everything internal.

How replies are delivered

Replies are delivered by email regardless of the conversation's channel. For email conversations this continues the thread naturally. For widget and website conversations, the server resolves an email address from the linked contact or the conversation's metadata — anonymous chats without any email cannot be replied to and return 400 missing_recipient.

The conversation draft

Each conversation stores at most one draft: an in-progress reply with content (HTML body) and an envelope (to, cc, bcc). Editing the draft never sends anything.

curl -s -X PATCH \
  -H "Authorization: Bearer $HC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<p>Hi Jane,</p><p>Thanks for reaching out...</p>"
  }' \
  "https://api.help.center/v0/centers/$HC_CENTER_ID/conversations/CONVERSATION_ID/draft"

PATCH upserts: only the fields you supply are updated. GET /draft returns the current draft (or null content plus resolved envelope defaults when none exists), and POST /draft/discard clears it.

Recipients and subject are resolved for you

When you send, the server fills in anything you didn't specify, using this precedence (highest wins):

  1. Fields supplied explicitly in the request body.
  2. Fields stored on the conversation's draft envelope.
  3. Values derived from the conversation history — for to, the sender of the most recent inbound message (or the recipient of the most recent outbound one); for cc, the other recipients of the last inbound message minus your own send addresses.
  4. Fallbacks: the contact's email address, then an email found in conversation metadata. BCC is never auto-populated.

The subject defaults to Re : <last inbound subject>. The sender address always comes from your center's configured support channel and cannot be overridden.

Please Note

The auto-generated Re : prefix has a space before the colon, and existing Re: prefixes are not deduplicated — long threads can produce Re : Re: Re: .... Pass an explicit subject if you need clean subjects.

Preview with dry_run

Both send endpoints accept a dry_run flag (JSON body or ?dry_run=true). The server runs the full resolver and returns the envelope, subject, and references it would use — without sending anything or touching the draft:

curl -s -X POST \
  -H "Authorization: Bearer $HC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dry_run": true}' \
  "https://api.help.center/v0/centers/$HC_CENTER_ID/conversations/CONVERSATION_ID/draft/send"
{
  "object": "reply_preview",
  "envelope": {
    "from": { "name": "Acme Support", "address": "[email protected]" },
    "to": [{ "name": "Jane", "address": "[email protected]" }],
    "cc": [],
    "bcc": []
  },
  "subject": "Re : Issue with checkout",
  "references": ["<[email protected]>"],
  "content": "<p>Hi Jane...</p>"
}

Use it to confirm recipients before committing — especially on widget and website conversations — and to debug missing_recipient errors without side effects.

Send

Send the stored draft (this clears it atomically):

curl -s -X POST \
  -H "Authorization: Bearer $HC_API_KEY" \
  "https://api.help.center/v0/centers/$HC_CENTER_ID/conversations/CONVERSATION_ID/draft/send"

Or reply directly without staging a draft:

curl -s -X POST \
  -H "Authorization: Bearer $HC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<p>Hi Jane,</p><p>Thanks for reaching out...</p>",
    "subject": "Re: Issue with checkout"
  }' \
  "https://api.help.center/v0/centers/$HC_CENTER_ID/conversations/CONVERSATION_ID/reply"

Both return the appended message and the updated conversation. On POST /reply, content is required (unless dry_run is set); to, cc, bcc, and subject are optional overrides.

Tip

Before composing, read the thread with GET /conversations/:id. If the latest inbound message is truncated, fetch it by ID for the full body — replies written off a truncated quote tend to miss what the customer actually said. And if an existing help article answers the question, link to it rather than restating it.

Reply errors

HTTP statusCodeMeaning
400missing_recipientNo to address could be resolved from any source.
400missing_contentThe reply had no content.
400empty_draftPOST /draft/send was called but the stored draft is empty.
500channel_not_configuredThe center has no verified support channel to send from.
502email_send_failedThe upstream email provider rejected the send.

Endpoint reference

ActionMethodEndpointScope
Get draftGET/v0/centers/:centerId/conversations/:conversationId/draftconversation.read
Update draftPATCH/v0/centers/:centerId/conversations/:conversationId/draftconversation.write
Discard draftPOST/v0/centers/:centerId/conversations/:conversationId/draft/discardconversation.write
Send draftPOST/v0/centers/:centerId/conversations/:conversationId/draft/sendconversation.reply
Send replyPOST/v0/centers/:centerId/conversations/:conversationId/replyconversation.reply

Related Articles

Was this article helpful?