Send test message
Queue an outbound WhatsApp message to any chat ID for the selected tenant.
API Reference
The Maya Gateway public API lets your tenant send WhatsApp messages, schedule follow-ups, and read conversation history. All requests are authenticated with a Bearer token provided by your account manager.
https://maya-saas-gateway.ad-net.workers.dev
Authorization header:Authorization: Bearer <YOUR_API_KEY>The gateway hashes your key with SHA-256 and looks it up in the
api_keys table. Contact your account manager to obtain or rotate a key.
| Path | Limit | Window |
|---|---|---|
| POST /v1/messages/send | 60 requests | 60 s per tenant |
| POST /webhook/:tenant | 120 requests | 60 s per tenant |
429 Rate Limited. Retry after ~60 seconds.Request body — Content-Type: application/json
| Field | Type | Required | Notes |
|---|---|---|---|
| chatId | string | Yes | Format: <digits>@c.us. Digits: 6–15. |
| text | string | Yes | Max 4096 characters. |
Success 200 — {"queued":true,"id":42}. Delivered asynchronously within ~1–2 s.
curl -X POST https://maya-saas-gateway.ad-net.workers.dev/v1/messages/send -H "Authorization: Bearer <YOUR_API_KEY>" -H "Content-Type: application/json" -d '{"chatId":"447911123456@c.us","text":"Hi! Just following up."}'Request body — provide exactly one of delay_seconds or run_at.
| Field | Type | Required | Notes |
|---|---|---|---|
| chatId | string | Yes | Same format as /v1/messages/send. |
| body | string | Yes | Max 4096 characters. |
| delay_seconds | number | One of | Seconds from now. Clamped to [60, 2592000]. |
| run_at | number | One of | Millisecond epoch, must be in the future. Takes precedence over delay_seconds. |
| kind | string | No | Label (max 32 chars). Default: "manual". AI personas set "auto". |
Success 200 — {"scheduled":true,"id":17,"run_at":1717100000000}
curl -X POST https://maya-saas-gateway.ad-net.workers.dev/v1/followups -H "Authorization: Bearer <YOUR_API_KEY>" -H "Content-Type: application/json" -d '{
"chatId": "447911123456@c.us",
"body": "Just checking in — did you get to look at the proposal?",
"delay_seconds": 86400,
"kind": "nurture"
}'Query params — chatId (optional), status (optional, default pending; one of pending / sent / cancelled). Returns up to 100 results, newest first.
curl "https://maya-saas-gateway.ad-net.workers.dev/v1/followups?chatId=447911123456@c.us&status=pending" -H "Authorization: Bearer <YOUR_API_KEY>"
Only pending follow-ups are updated; already-sent or cancelled rows are silently ignored (still returns 200). :id is the integer from the POST response.
curl -X DELETE https://maya-saas-gateway.ad-net.workers.dev/v1/followups/17 -H "Authorization: Bearer <YOUR_API_KEY>"
# → {"ok":true,"cancelled":1}Query params — chatId (optional). Omit for the last 50 messages across all contacts; provide for a single contact's last 50, newest first. direction is "in" (received) or "out" (sent by bot).
curl "https://maya-saas-gateway.ad-net.workers.dev/v1/conversations?chatId=447911123456@c.us" -H "Authorization: Bearer <YOUR_API_KEY>"
Returns {"ok":true,"ts":"2026-05-30T10:00:00.000Z"}.
curl https://maya-saas-gateway.ad-net.workers.dev/health
A persona prompt can instruct the AI to schedule its own follow-ups by embedding a tag in the reply:
[FOLLOWUP:<delay_seconds>:<message text>]Example in an AI reply:
Great talking with you![FOLLOWUP:86400:Just checking — did you get a chance to review the info?]The Worker strips the tag before delivery (end-users never see it), inserts a follow-up row with
kind = "auto", and clamps the delay to [60, 2592000] s. Auto-scheduled follow-ups appear in GET /v1/followups and can be cancelled via DELETE /v1/followups/:id.
error field: {"error":"Description of the problem."}| Status | Meaning |
|---|---|
| 400 | Bad request — missing or invalid field. See endpoint table for exact messages. |
| 401 | Unauthorized — Bearer token missing, inactive, or not recognised. |
| 404 | Not found — endpoint path does not exist. |
| 409 | Conflict — resource already exists (e.g. duplicate tenant ID). |
| 429 | Rate limited — per-tenant limit exceeded. Retry after ~60 s. |
| 500 | Internal server error — unhandled exception. |
<country_code><subscriber_number>@c.us. Digits: 6–15. Examples:UK +44 7911 123456 →
447911123456@c.us · US +1 415 555 0100 → 14155550100@c.usTimestamps — all
created_at, run_at, sent_at fields are millisecond Unix epoch integers (Date.now() format).Follow-up status values —
pending: not yet fired · sent: delivered to outbox · cancelled: cancelled via DELETE.
Payments
Recent paid orders for the selected tenant.
Bot persona
Edit the system prompt, model, and status for the selected tenant. Changes apply to new conversations.
https://. We POST {"email","plan","amount","currency","chat_id"} signed in header X-Maya-Signature.Europe/Madrid, America/New_York. Default 21 → 9 = silent 9 PM to 9 AM.