Skip to main content

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


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.
Payload shape: Top-level flat fields; 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:

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), campaignId, campaignName, and integration IDs.

Full example body

event
string
"message.sent"
messageId
string
Tuco message ID
message
object
Full message document (not string)
leadId
string
Lead ID when known
lead
object
Full lead when available
ghlContactId
string | null
GHL contact ID for integrations
ghlLocationId
string | null
GHL location ID for integrations
timestamp
string
When the webhook was fired (ISO UTC)

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 when a message has exhausted all retry attempts or encountered an unrecoverable error (e.g. availability API failure). The message field is the full message object (includes errorMessage when set). data may include error (reason string).

Full example body

event
string
"message.failed"
message
object
Full message document (includes errorMessage)
data.error
string
Human-readable explanation of the failure
When sendFallbackSmsOnFailed is enabled (per-message or workspace-level) and Twilio is configured, Tuco automatically sends a fallback SMS on this event. You don’t need to build that logic yourself.

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

event
string
"message.fallback"
message
object
Full message document (status fallback)
data.reason
string
Human-readable explanation
data.checkedAddresses
string[]
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 campaigns 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

event
string
"message.opened"
message
object
Full message document including readAt (ISO UTC when read)
data.readAt
string
When the message was opened (ISO UTC)

Shared fields (all events)

Every webhook payload includes these base fields:

Headers & signature verification

Every webhook POST includes these headers: Verify signatures to confirm webhooks actually came from Tuco:
Your webhook secret is shown once when you create the webhook. Save it immediately. You can’t retrieve it later — you’d need to delete and recreate the webhook.

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: queued → sent → delivered. 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.
Tuco does not retry webhook delivery. Each event fires once (fire-and-forget). If your endpoint is down or returns a non-2xx status, that delivery is lost. Make sure your endpoint is reliable and returns 2xx quickly. You can use the health-check endpoint to verify your endpoint is reachable.