Approve a draft
POST/v1/drafts/{draft_id}/approve
- Scope
messages:send
Sends the draft, optionally with edited text, under the approving key's own limits. The key needs messages:send and must not be draft-only. Approving again answers 200 with the same message.
Parameters
Path
draft_idstringrequiredThe draft (
drf_…).
Request body
textstringSend this text instead of the draft's.
Response
200 OKAlready approved: the same message.
draftDraftrequiredA message a draft-only key wrote, waiting for a person to approve it.
Fields of
draftidstringrequireddrf_…object"draft"requiredprofile_idstringrequiredprf_…chat_idstring or nullrequiredtostringrequiredtextstring or nullrequiredattachmentsarray of objectrequiredreply_tostring or nullrequiredservicestring or nullrequiredeffectstring or nullrequiredstatus"pending" | "approved" | "rejected"requiredreasonstring or nullrequiredWhy it was rejected, if the person said.
message_idstring or nullrequiredOnce approved: the message it became.
created_bystringrequiredapi_key:key_…(the draft-only key that wrote it).decided_bystring or nullrequireduser:usr_…orapi_key:key_….decided_attimestamp or nullrequiredcreated_attimestamprequired
messageMessagerequiredA message sent or received on a line.
Fields of
messageidstringrequiredmsg_…object"message"requiredprofile_idstringrequiredprf_…chat_idstringrequiredcht_…chat_handlestringThe chat's address: a phone number, email or group chat id.
direction"inbound" | "outbound"requiredsenderstring or nullrequiredWho sent an inbound message (in group chats, one of the members).
textstring or nullrequiredattachmentsarray of AttachmentrequiredFields of
attachmentsidstringrequiredatt_…file_namestring or nullrequiredmime_typestring or nullrequiredsize_bytesinteger or nullrequiredurlstringrequiredA path on the API:
GETit with your key and follow the302to a short-lived download link.
servicestring or nullrequiredHow it went or came:
iMessage,RCSorSMS. Null until known.requested_servicestring or nullrequiredThe
servicethe send asked for, if any.fallback_fromstring or nullrequiredSet when the message failed over: the service it started on (
iMessage).reactionsarray of ReactionrequiredFields of
reactionskind"love" | "like" | "dislike" | "laugh" | "emphasize" | "question" or "emoji"requiredOne of the six tapbacks, or
emojifor an emoji reaction.emojistring or nullrequiredThe emoji, when
kindisemoji.fromstringrequired"me"for the line's own reaction, else the person's address.attimestamp or nullrequired
status"queued" | "dispatched" | "sent" | "delivered" | "read" | "failed" | "unconfirmed" | "received"requiredqueued→dispatched→sent→delivered→read(iMessage only), orfailed/unconfirmed. Inbound messages arereceived.errorobject or nullrequiredWhy a message failed:
line_unavailable,recipient_not_allowed,sending_paused,unconfirmedorsend_failed.Fields of
errorcodestringrequiredmessagestringrequired
guidstring or nullrequiredThe message's id in Messages, once it has one.
created_attimestamprequiredsent_attimestamp or nullrequireddelivered_attimestamp or nullrequiredread_attimestamp or nullrequiredqueue_untiltimestamp or nullrequiredWhile
queued: when the send gives up if the line is still unavailable.
202 AcceptedApproved and queued.
draftDraftrequiredA message a draft-only key wrote, waiting for a person to approve it.
Fields of
draftidstringrequireddrf_…object"draft"requiredprofile_idstringrequiredprf_…chat_idstring or nullrequiredtostringrequiredtextstring or nullrequiredattachmentsarray of objectrequiredreply_tostring or nullrequiredservicestring or nullrequiredeffectstring or nullrequiredstatus"pending" | "approved" | "rejected"requiredreasonstring or nullrequiredWhy it was rejected, if the person said.
message_idstring or nullrequiredOnce approved: the message it became.
created_bystringrequiredapi_key:key_…(the draft-only key that wrote it).decided_bystring or nullrequireduser:usr_…orapi_key:key_….decided_attimestamp or nullrequiredcreated_attimestamprequired
messageMessagerequiredA message sent or received on a line.
Fields of
messageidstringrequiredmsg_…object"message"requiredprofile_idstringrequiredprf_…chat_idstringrequiredcht_…chat_handlestringThe chat's address: a phone number, email or group chat id.
direction"inbound" | "outbound"requiredsenderstring or nullrequiredWho sent an inbound message (in group chats, one of the members).
textstring or nullrequiredattachmentsarray of AttachmentrequiredFields of
attachmentsidstringrequiredatt_…file_namestring or nullrequiredmime_typestring or nullrequiredsize_bytesinteger or nullrequiredurlstringrequiredA path on the API:
GETit with your key and follow the302to a short-lived download link.
servicestring or nullrequiredHow it went or came:
iMessage,RCSorSMS. Null until known.requested_servicestring or nullrequiredThe
servicethe send asked for, if any.fallback_fromstring or nullrequiredSet when the message failed over: the service it started on (
iMessage).reactionsarray of ReactionrequiredFields of
reactionskind"love" | "like" | "dislike" | "laugh" | "emphasize" | "question" or "emoji"requiredOne of the six tapbacks, or
emojifor an emoji reaction.emojistring or nullrequiredThe emoji, when
kindisemoji.fromstringrequired"me"for the line's own reaction, else the person's address.attimestamp or nullrequired
status"queued" | "dispatched" | "sent" | "delivered" | "read" | "failed" | "unconfirmed" | "received"requiredqueued→dispatched→sent→delivered→read(iMessage only), orfailed/unconfirmed. Inbound messages arereceived.errorobject or nullrequiredWhy a message failed:
line_unavailable,recipient_not_allowed,sending_paused,unconfirmedorsend_failed.Fields of
errorcodestringrequiredmessagestringrequired
guidstring or nullrequiredThe message's id in Messages, once it has one.
created_attimestamprequiredsent_attimestamp or nullrequireddelivered_attimestamp or nullrequiredread_attimestamp or nullrequiredqueue_untiltimestamp or nullrequiredWhile
queued: when the send gives up if the line is still unavailable.
Errors
| Status | Code | Means |
|---|---|---|
| 409 | draft_rejected | The draft was rejected. |
| 403 | draft_only_key | This key can only write drafts; typing, reactions and read receipts aren't drafts. |
| 409 | draft_conflict | A message already uses the draft's idempotency key. |
| 429 | rate_limited | The key's sends for this window are used up. |
| 429 | new_conversation_limit | The line started as many new conversations in the last 24 hours as it may. Replies, and messages to anyone who already wrote to the line, still go. |
| 403 | sending_paused | We paused sending on your account (or this line) while we review recent activity that looked like mass texting. Incoming messages still arrive. details.scope is team or line. |
| 402 | payment_required | The team's subscription isn't paid up, so sending is paused. |
| 400 | validation_failed | A field is missing or invalid. |
| 401 | unauthorized | The API key is missing, unknown or revoked. |
| 403 | insufficient_scope | The API key lacks the scope this needs. |
| 404 | not_found | No such object, or the key can't see it. |
Every error is { "error": { "code", "message" } }. All error codes.