What the Messages API Does
The Messages API lets your systems send messages through the same Tuco engine used by the product UI. When a request is accepted:- A message record is created in Tuco.
- The message appears in the Tuco UI with a clear status.
- The message can be included in reporting, exports, and audits.
Message Lifecycle You Can See
From your perspective, each message moves through a small set of visible states, such as:- Waiting to be sent.
- Successfully sent or delivered.
- Not sent, with a clear reason.
Sending from Your Own Systems
When you send through the API, you decide:- Which workspace owns the message.
- Which line it should appear to come from.
- Which recipient should receive it.
Personalization with Lead Fields
Messages sent through the API can use simple placeholders such as first name and other basic lead fields for personalization. From your point of view:- You decide which fields to keep up to date on each lead.
- Tuco applies those fields when rendering messages at send time.
Notifications & Webhooks
If you choose to connect webhooks for message events, your systems can receive simple notifications when key changes occur, such as deliveries or replies. Webhook details and advanced configurations are described in/api-reference/message-webhooks. These options are designed so that you can mirror what you already see in Tuco without needing to understand internal delivery logic.
In particular, failure and fallback‑style events make it easy for you to trigger your own follow‑up flows, such as sending an SMS or WhatsApp message when a contact cannot be reached on the channel you originally chose.
Send iMessage to a Contact
Endpoint
- Method:
POST - Path:
/api/messages - Auth: Tuco API key (server-side) or Clerk token
Required Fields
message(string) – body of the message.messageType("imessage" | "sms" | "email") – use"imessage"for iMessage.fromLineId(string) – ID of the line sending the message (from/api/lines/by-user).- One of:
leadId(string) – send to an existing lead, using their stored contact details, orrecipientPhone(string) and/orrecipientEmail(string) – send directly to a raw contact.
Optional Fields
recipientName(string) – display name for the recipient (otherwise derived from the lead when possible).scheduledDate(string, ISO 8601) – schedule for a future UTC time.batchId(string) – arbitrary identifier to group related messages.- Time window settings (optional, align with campaigns):
timezone(IANA string, e.g."America/New_York")sendWindowStart("HH:mm")sendWindowEnd("HH:mm")allowedDaysOfWeek(number[] | string[])
Example: Send iMessage to an Existing Lead
Example: Send iMessage to a Raw Contact
Success Response (201 Created)
400 for validation issues, 401 for auth problems, or 402 READ_ONLY when the workspace is temporarily read‑only).