maya · console
Sign in to manage tenants and conversations.
maya · console
WhatsApp agent platform
Tenant
Create tenant
lowercase · digits · - · _
Tenants
Messages
Live
Select a tenant to see messages.

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.

Base URL https://maya-saas-gateway.ad-net.workers.dev
Authentication
All tenant endpoints require an 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.
Rate Limits
PathLimitWindow
POST /v1/messages/send 60 requests 60 s per tenant
POST /webhook/:tenant 120 requests 60 s per tenant
Exceeding a limit returns 429 Rate Limited. Retry after ~60 seconds.
Endpoints
POST /v1/messages/send Queue an outbound WhatsApp message

Request body — Content-Type: application/json

FieldTypeRequiredNotes
chatIdstringYesFormat: <digits>@c.us. Digits: 6–15.
textstringYesMax 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."}'
POST /v1/followups Schedule a future message

Request body — provide exactly one of delay_seconds or run_at.

FieldTypeRequiredNotes
chatIdstringYesSame format as /v1/messages/send.
bodystringYesMax 4096 characters.
delay_secondsnumberOne ofSeconds from now. Clamped to [60, 2592000].
run_atnumberOne ofMillisecond epoch, must be in the future. Takes precedence over delay_seconds.
kindstringNoLabel (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"
  }'
GET /v1/followups List scheduled follow-ups

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>"
DELETE /v1/followups/:id Cancel a pending follow-up

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}
GET /v1/conversations Read conversation history

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>"
GET /health Liveness check — no auth required

Returns {"ok":true,"ts":"2026-05-30T10:00:00.000Z"}.

curl https://maya-saas-gateway.ad-net.workers.dev/health
Inbound Auto-replies & the [FOLLOWUP] Tag
When a WhatsApp user messages your bot, the platform runs the AI persona against the last 12 messages of history and delivers a reply automatically — no webhook to build.

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 Codes
All errors return JSON with a single error field: {"error":"Description of the problem."}
StatusMeaning
400Bad request — missing or invalid field. See endpoint table for exact messages.
401Unauthorized — Bearer token missing, inactive, or not recognised.
404Not found — endpoint path does not exist.
409Conflict — resource already exists (e.g. duplicate tenant ID).
429Rate limited — per-tenant limit exceeded. Retry after ~60 s.
500Internal server error — unhandled exception.
Field Reference
chatId format — <country_code><subscriber_number>@c.us. Digits: 6–15. Examples:
UK +44 7911 123456 → 447911123456@c.us  ·  US +1 415 555 0100 → 14155550100@c.us

Timestamps — 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.

Select a tenant to see payments.

Bot persona

Edit the system prompt, model, and status for the selected tenant. Changes apply to new conversations.

Number health
● All healthy — no recent alerts.
Knowledge base
FAQ, pricing, and policies the bot answers from. Max 12 000 characters.
0 / 12000
Plans & payment links
Paste Stripe Payment Link URLs from your Stripe dashboard. The bot appends the matching link when a customer commits to a plan.
Key Label Stripe URL (https://) Amount Currency
Set a fixed URL for a pre-made link, OR amount (minor units, e.g. cents) + currency to auto-generate a tracked checkout (needs the Stripe key). Key: alphanumeric/dash/underscore, ≤32 chars.
Payments / fulfillment
On every paid order we POST the buyer + plan to your webhook URL so your site can provision access and send a receipt email. The bot also sends the customer a WhatsApp confirmation.
Must start with https://. We POST {"email","plan","amount","currency","chat_id"} signed in header X-Maya-Signature.
We HMAC-SHA256 the POST body with this secret. Verify on your end to confirm the request is from Maya.
Sending limits — protect your number from bans
Safe limits are pre-filled. Only raise them once this number is well established. Replies to people who message you first are never limited — these only cap messages you start.
Total messages this number sends out in a day.
People who've never replied to you (cold outreach). This is the #1 thing that gets numbers banned — keep it low.
Wait time between two cold messages, so sending doesn't look automated. 60 = at most one new person a minute.
From (hour, 0–23)
To (hour, 0–23)
Timezone (your customers')
No outbound goes out during these hours, in the timezone you set — e.g. Europe/Madrid, America/New_York. Default 21 → 9 = silent 9 PM to 9 AM.
Connect WhatsApp
Initiating…
Starting connection…
Duplicate tenant
Creates a copy with a new ID and name.
lowercase · digits · - · _