Overview
Message webhooks push status updates to a URL you control whenever a message reaches a terminal state. Configure them in your workspace settings — Tuco handles delivery automatically.Webhook calls are POST requests with a JSON body. All events share the same
base fields; each event type adds its own specific fields. Outgoing message
events are fired when a message is sent (accepted by Tuco), not when
delivery is confirmed on the recipient’s device.
Event types
Group chats have their own events. A webhook on
message.* never receives a group
message — tick the group.message.* events to get them. See Group chat events.message.ai_draft — review AI drafts from your own tools
When your knowledge base runs in Copilot mode, every AI-drafted reply fires
message.ai_draft before anything is sent. The payload carries the draft text
on message (string) and a data.replyId handle:
action is approve (claims the draft and sends it), reject, or
mark_sent (claim only — you already delivered the text yourself). The claim
is atomic and first-action-wins across every channel, so an approval from
Telegram, the dashboard, and your API call can never double-send. A 409
response means another channel already actioned the draft.
Every resolution then fires message.ai_draft_approved or
message.ai_draft_rejected — regardless of which channel actioned it —
with data.approvalChannel (dashboard, api, telegram, telegram_edit,
telegram_retry, unibox_direct_send) so your workflow can log who approved
what, including approvals that never touched your tools.
message.reply
Sent when a new reply from a lead or contact is recorded. Use it to update your CRM, trigger automations, or log conversations.
When a contact owner is set (
contactOwnerEmail), reply email notifications are routed only to the contact owner rather than all workspace users.data.reply is identical to one item in GET /api/replies (same keys, same types). Reply text is top-level message (string). parentMessages is always present (array; possibly empty).
Top-level fields
message (reply text only)
For message.reply, message is the reply text only (string) — what the lead or contact replied with.
data.reply — matches GET /api/replies item exactly
data.reply has the exact same shape as one element of GET /api/replies replies array:
Plus
recentReplies — the last 10 inbound replies from this lead (array, possibly empty):
Example payload:
Reply with a photo/file
When the lead replies with an image or file, the same payload additionally carriesattachmentDownloadUrls + attachmentNames (top-level and inside data.reply / its recentReplies). GET a download URL to store the bytes — no Authorization header needed, the signature is the capability:
Multiple attachments per reply. A single reply can carry many photos/files —
attachmentDownloadUrls and attachmentNames are parallel arrays with one entry per
attachment (there is no longer a 2-attachment cap; the full set is captured).Large bursts arrive progressively. When a lead sends a big batch (e.g. 20 photos), the
first few are attached to the message.reply webhook right away and the rest are ingested
in the background — the underlying iMessage server hands each attachment over slowly, so a
large burst takes a couple of minutes to finish. The webhook is not re-sent as the
remainder land, so to get the complete set for a messageId, call
GET /api/replies a minute or two after the reply.message.sent
Sent when a message has been sent (accepted by Tuco). This is the only
outgoing-message event fired to your webhook; Tuco does not fire a separate
event when delivery is confirmed on the recipient’s device.
Payload: The message field is the full message object (not a string), with _id, message, messageType, status, fromLineId, recipientPhone, recipientEmail, recipientName, leadId, workspaceId, createdByUserId, sentAt, createdAt, updatedAt, etc. Top-level also includes leadId, lead (full lead when available), and integration IDs.
Full example body
How the message actually left:
imessage, p2p_sms, email, or call. See P2P SMS.message.sent fires exactly once per message, whichever way the send was confirmed.
P2P SMS (green bubble from your line)
When a line has P2P SMS on and the recipient isn’t on iMessage, the line’s paired iPhone sends a regular SMS from the line’s own number. That is a successful send by your line, so you getmessage.sent with "channel": "p2p_sms", and no message.fallback.
The message object keeps messageType: "imessage" (what was requested) and carries
smsForwarded: true, so read channel rather than messageType to know how it actually went out.
Abbreviated: only the fields that differ from the full example above are shown.
P2P SMS is different from fallback. Fallback (
message.fallback) means the message went out
through your workspace’s fallback provider (Twilio, GoHighLevel, or your own fallback webhook) from
a different number. A message never produces both.message.reaction
Sent when a lead or contact reacts to an existing message in a conversation.
Tuco treats reactions differently from replies:
- they are stored as reactions on the original message
- they do not become a normal text reply
- they do not trigger AI reply handling
Top-level fields
Example payload
message.failed
Sent once when a message definitely did not go out:
message.failed is not sent when delivery simply could not be confirmed (the message may
still have arrived — check the conversation), or when Tuco declines to send a message (for example
a link or attachment in the very first message to a new contact). The message field is the
full message object, including errorMessage, failureReason (line_down_expired or
transient_exhausted) and failureClass. data.error repeats the reason.
Full example body
Tuco does not send an SMS because of
message.failed. To retry another way, do it from your
workflow when this event arrives. (Recipients without iMessage are a different case:
see message.fallback.)message.fallback
Sent when Tuco determines that the primary channel (e.g. iMessage) is not
available for this recipient. This is a business outcome, not a technical
failure. The message field is the full message object. data includes reason and optionally checkedAddresses (string[]).
Full example body
All addresses Tuco checked for iMessage availability before deciding fallback.
Useful for debugging and auditing.
Common patterns
Auto-send SMS
Trigger an SMS via your own Twilio/fallback when you receive
message.fallback.
Or enable Tuco’s built-in fallback SMS on the workspace.Tag lead in CRM
Flag the lead as “no iMessage” so future sends pick the right channel
automatically.
message.opened
Sent when the recipient has opened/read the message (read receipt). Fired where the channel supports read receipts. Use it to track engagement or trigger follow-ups.
Payload: Same top-level shape as message.sent. The message field is the full message object (not a string), including readAt (ISO 8601 UTC) when the message was read. data may include readAt.
Full example body
conversation.handover
Fires once when the AI SDR decides a conversation needs a person and stops replying to it.
This is the event to wire to your routing, your inbox or your on-call rota — it is the only
signal that a lead is waiting on a human.
The AI is already paused when this fires (
data.handover.aiPaused is always true). Nothing
further is sent on that conversation until a person takes it.data.handover
What the AI would have said, held back. Hand this to whoever picks the conversation up so
the lead does not have to repeat themselves. Omitted when there was no draft.
leadId and contactOwnerEmail are also lifted to the top level so you can route on owner
without reaching into data.handover. They are omitted when unknown.Group chat events
For iMessage group chats your line is in. A group is not a lead, so these events have noleadId, lead or CRM ids. Instead every group event carries a
top-level group object.
Each fires once per message (once per tapback for reactions), like the 1:1 events.
The group object
group.message.received
message is the full message doc. message.groupSenderAddress is the sender too.
Photos and files are in attachmentUrls and, fetchable with no auth, attachmentDownloadUrls.
group.message.sent
Same shape, with direction: "sent", status: "sent" and group.sender: null.
data.voiceNote is true for a voice note.
- A text or file send fires when every part of it is in the group.
- A voice note fires when it lands (a few seconds after the API answers).
- A message typed on the phone itself does not fire (same as 1:1).
group.message.failed
Same shape, with status: "failed" and the reason in data.error:
group.message.reaction
messageId is the message that was reacted to. group.sender is who reacted.
Your own reactions do not fire (same as 1:1).
Shared fields (all events)
Every webhook payload includes these base fields:call.recording.ready
Sent once per call, when the call’s recording has been stored. Use
data.recordingDownloadUrl to fetch the audio: it is a signed, public link valid for
30 days and needs no Authorization header. data.recordingUrl is the raw storage
location and is not fetchable with an API key.
Full example body
dnc.added
Sent once per new Do-Not-Contact entry. Use it to stop the same person on your
other channels (WhatsApp, email, dialer) the moment they opt out of iMessage.
It fires when:
- a contact replies with an opt-out keyword (
STOP,UNSUBSCRIBE,OPT OUT,REMOVE ME,DO NOT CONTACT) on iMessage, or a carrier keyword (STOP,STOPALL,UNSUBSCRIBE,CANCEL,END,QUIT) to your Telnyx or Twilio fallback number - someone adds a contact in the dashboard, or you call
POST /api/dnc
STOP from someone already on the list does not fire again. Bulk CSV and
list imports, and DNC mirrored in from GoHighLevel or HubSpot, do not fire — read those
with GET /api/dnc?since=.
The reply itself still arrives as message.reply with optedOut: true.
Try it without waiting for a real opt-out:
opt_out (replied STOP) and manual (added via the dashboard or API).
Full example body
keyword-<WORD> for a reply (e.g. keyword-STOP), api for POST /api/dnc with an API key, manual-ui for the dashboard.Headers & signature verification
Every webhook POST includes these headers:Delivery guarantees
- Each event fires once per webhook.
message.sentfires once per message, whichever way the send was confirmed;message.replyonce per inbound message;message.failed,message.fallback,message.opened,message.reactionand themessage.ai_draft*events once per message, reaction or draft. - If your endpoint does not answer
2xxwithin 10 seconds, Tuco retries once after 5 seconds with the sameX-Tuco-Delivery-Id. If your endpoint already processed the first attempt (it was just slow), drop the retry by that id. - Every delivery is kept for 30 days in the delivery log, with the exact body sent and your endpoint’s response.
Consuming webhooks safely
1
Use messageId + event as your key
Make updates idempotent. If you’ve already processed a
(messageId, event) pair, ignore duplicates.2
Move status forward only
Only update your local status in the forward direction
(for example
sent after queued). Never move backwards.3
Return 200 quickly
Tuco expects a
2xx response within a few seconds. Do heavy processing
asynchronously after acknowledging the webhook.4
Log workspaceId and leadId
These fields let you trace events back to the right tenant and contact
in multi-workspace setups.