Skip to content
API Reference

Twilinker Messaging API

Send WhatsApp (Cloud API & OpenWA) and SMS messages, inspect delivery receipts, manage templates, configure webhooks, and monitor dispatches over a single REST interface.

Base URL https://twilinker.com/api/messaging

Overview & Status Codes

All requests and responses use JSON (Accept: application/json, Content-Type: application/json). Every per-sender endpoint is scoped by numeric {wabaSender} ID and enforces workspace ownership.

Status Meaning
200 OK / 201 CreatedRequest succeeded or message/dispatch queued.
401 UnauthorizedMissing, invalid, or expired Bearer token.
402 Payment RequiredAccount subscription has ended (code: "subscription_required"). Renew to resume sending.
403 ForbiddenOAuth token lacks the required scope or cannot reach that sender/account.
404 Not FoundSender, message, dispatch, or template does not exist (or does not belong to this sender/account).
422 Unprocessable EntityValidation error (invalid phone number, missing fields, or unsupported driver action).

Authentication & OAuth Scopes

Authenticate every request with a Bearer token in the Authorization header. Twilinker accepts both Sanctum personal API keys (full access to your workspaces) and Passport OAuth 2.0 access tokens (scoped per sender and per ability via consent screen).

Authorization: Bearer YOUR_API_OR_OAUTH_TOKEN
Accept: application/json
Content-Type: application/json
Active Subscription Check: Endpoints marked Active subscription require a serving subscription when the account has a subscription record. If your subscription has ended, sending returns 402 with code: "subscription_required". Read endpoints stay available.
OAuth Scopes
Scope Description
mcp:use Send WhatsApp messages and manage templates through an AI assistant
Implies: messages:send, templates:write
accounts:read See the details of its account
senders:read See the details of this sender
templates:read See the message templates of its account
templates:write Create message templates and submit them for approval
messages:read Read messages, their delivery status and their media
messages:send Send messages from this sender

Discovery

Inspect the authenticated identity, reachable workspaces, and WhatsApp senders.

GET /api/messaging/me auth:sanctum,api

Returns the authenticated user, whether the token is OAuth, and reachable accounts.

curl -s "https://twilinker.com/api/messaging/me" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Accept: application/json"
GET /api/messaging/accounts accounts:read

Lists all workspace accounts reachable by the current token.

curl -s "https://twilinker.com/api/messaging/accounts" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Accept: application/json"
GET /api/messaging/senders senders:read

Lists reachable WhatsApp senders (Cloud API & OpenWA). Optional query filter: ?account_id=12.

curl -s "https://twilinker.com/api/messaging/senders?account_id=12" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Accept: application/json"

Sender Status & Groups

Inspect sender metadata, live connection health, approved templates, and OpenWA WhatsApp groups.

GET /api/messaging/{wabaSender} senders:read

Returns sender configuration, phone number, driver (Cloud API vs OpenWA), and status.

GET /api/messaging/{wabaSender}/status senders:read

Returns live connection state (connected, driver, and OpenWA session status when applicable).

curl -s "https://twilinker.com/api/messaging/123/status" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Accept: application/json"
GET /api/messaging/{wabaSender}/templates templates:read

Lists approved templates available for sending from this WhatsApp sender.

GET /api/messaging/{wabaSender}/groups POST /groups/sync senders:read

Lists cached WhatsApp groups (?search=, ?page_size=20) or triggers a live sync from the OpenWA gateway via POST /groups/sync.

Sending Messages

Queue single messages, templates, bulk dispatches, or typing indicators.

POST /api/messaging/{wabaSender}/quick-send Active subscription messages:send

Sends a single WhatsApp message (text, image, document, audio, video, location, contacts, interactive) directly over REST โ€” no client SDK required. On OpenWA senders, to also accepts chat IDs ([email protected], ...@lid) and group IDs ([email protected]).

curl -s -X POST "https://twilinker.com/api/messaging/123/quick-send" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+212600000000",
    "type": "text",
    "text": { "body": "Hello from Twilinker!" }
  }'
POST /api/messaging/{wabaSender}/quick-send/template Active subscription messages:send

Sends an approved WhatsApp Business template with optional variable components (Cloud API).

curl -s -X POST "https://twilinker.com/api/messaging/123/quick-send/template" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+212600000000",
    "template": "order_shipped",
    "language": "en_US",
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "ORD-4821" }
        ]
      }
    ]
  }'
POST /api/messaging/{wabaSender}/send Active subscription messages:send

Creates a multi-recipient dispatch and queues messages asynchronously. Returns the created dispatch ID for tracking.

POST /api/messaging/{wabaSender}/typing messages:send

Sends a typing presence indicator on OpenWA senders ({"to": "+212600000000", "state": "typing"}, or "paused").

Messages, Receipts & Media

Query inbound and outbound message history, mark inbound messages as read, and download media attachments.

GET /api/messaging/{wabaSender}/messages messages:read

Paginated message log for this sender. Supports query filters: direction (in|out), status, to, from, search, page_size (1โ€“100).

curl -s "https://twilinker.com/api/messaging/123/messages?direction=in&page_size=20" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Accept: application/json"
GET /api/messaging/{wabaSender}/messages/{message} messages:read

Fetches a single message and its delivery/read timestamps (sent_at, delivered_at, read_at, failed_at).

POST /api/messaging/{wabaSender}/read/{message} messages:read

Marks an inbound WhatsApp message as read (blue ticks).

GET /api/messaging/{wabaSender}/media/{message} messages:read

Streams or redirects to the media attachment belonging to an inbound or outbound message.

Dispatches & Retries

Track batch sends, inspect failed recipients, and re-queue failed messages.

GET /api/messaging/{wabaSender}/dispatches messages:read

Lists dispatches for this sender. Drill down with:

GET /{wabaSender}/dispatches/{dispatch}Single dispatch summary & counts.
GET /{wabaSender}/dispatches/{dispatch}/messagesPaginated messages in this dispatch (supports ?status=).
GET /{wabaSender}/send/{dispatch}/failed/Failed messages for this dispatch.
POST /api/messaging/{wabaSender}/dispatches/{dispatch}/retry Active subscription messages:send

Re-queues failed messages on a dispatch for another delivery attempt.

Webhooks & Delivery Logs

Configure per-sender webhook URLs and inspect incoming/outgoing webhook delivery attempts.

GET PUT /api/messaging/{wabaSender}/webhooks senders:read / messages:send

Read or update webhook_url (delivery & message events) and bot_webhook_url (AI agent webhook) on this sender.

curl -s -X PUT "https://twilinker.com/api/messaging/123/webhooks" \
  -H "Authorization: Bearer $TWILINKER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://example.com/webhooks/twilinker",
    "bot_webhook_url": "https://example.com/agent/whatsapp"
  }'
GET /api/messaging/{wabaSender}/webhook-logs messages:read

Returns recent webhook delivery logs with payloads, HTTP status codes, and errors. Filters: direction (out|in), event, status, page_size.

Account & Template Management

Manage account-level details and WhatsApp Business message templates (draft, submit to Meta, delete).

GET /api/messaging/account/{account} accounts:read
GET /account/{account}Account details & balance (accounts:read).
GET /account/{account}/sendersSenders belonging to this account (senders:read).
GET /account/{account}/templatesAll templates on this account (templates:read).
GET /account/{account}/templates/{template}Single template with components & Meta status (templates:read).
POST /account/{account}/templatesCreate a draft template (templates:write).
POST /account/{account}/templates/{template}/submitSubmit a draft template to Meta for approval (templates:write).
DELETE /account/{account}/templates/{template}Delete a template (templates:write).

SMS Sender

Inspect an SMS sender and send SMS messages.

GET /api/messaging/sms/{smsSender} POST /send Active subscription senders:read / messages:send

Fetch SMS sender details (GET) or send an SMS message (POST /send).