Browse the docs

API

Inbox

Send WhatsApp messages from your own system and read the messages in and out of your business. Messages sent with a key show in the chat as automated, and they do not stop an automation running in that chat.

Send a message

POST https://gdwaapi.grapedawn.tech/api/v1/messages sends either text or a template to one phone number.

FieldRequiredWhat it is
toYesThe phone number with its country code, such as +919800000001
textOne of these twoPlain text, up to 4,096 characters
templateOne of these twoAn approved template and its values (see Fill in a template)

Send text:

curl https://gdwaapi.grapedawn.tech/api/v1/messages \
  -H "Authorization: Bearer lms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"to": "+919800000001", "text": "Your order is on its way."}'

Send a template:

curl https://gdwaapi.grapedawn.tech/api/v1/messages \
  -H "Authorization: Bearer lms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"to": "+919800000001", "template": {"name": "order_update", "language": "en", "variables": {"1": "Asha", "2": "#1234"}}}'

The answer is the message you sent, as the message object. A number that is not a contact yet becomes one.

Errors to expect:

  • 422 Send either text or a template. when you send both or neither.
  • 422 when text is outside the 24-hour window (below).
  • 404 or 422 for a template problem (see Templates).
  • 400 when WhatsApp refuses the message, with its reason in message.
  • 402 when the message or the new contact would go over your plan.

The 24-hour rule

WhatsApp delivers free text only within 24 hours of the contact's last message to you. Outside that window, sending text fails with:

{
  "statusCode": 422,
  "message": "More than 24 hours have passed since this contact last wrote, so WhatsApp only delivers a template to them. Send a template instead.",
  "error": "Unprocessable Entity"
}

A template can be sent at any time, so use one for a first message or a reminder. A good pattern is to try text and, on that 422, send a template instead.

Read one message

GET https://gdwaapi.grapedawn.tech/api/v1/messages/:id returns one message, sent or received, by its id. Use it to check how far a message you sent has got.

curl https://gdwaapi.grapedawn.tech/api/v1/messages/6f1c2a4e-8b1d-4c55-9a0e-2d7f1b3c9e10 \
  -H "Authorization: Bearer lms_your_key"

A message that does not exist in your business gets a 404 with Message not found.

Poll for new messages

GET https://gdwaapi.grapedawn.tech/api/v1/messages?since=<time>&limit=<number> returns messages in and out created after a time, oldest first. Use it instead of the webhook, or alongside it so nothing is missed.

QueryRequiredWhat it is
sinceYesAn ISO 8601 time, such as 2026-11-27T10:00:00Z
limitNo1 to 200. Left out, 100
curl "https://gdwaapi.grapedawn.tech/api/v1/messages?since=2026-11-27T10:00:00Z&limit=100" \
  -H "Authorization: Bearer lms_your_key"

To read everything, keep the createdAt of the last message you got and pass it as since next time. When a page comes back full, ask again straight away.

The message object

{
  "id": "6f1c2a4e-8b1d-4c55-9a0e-2d7f1b3c9e10",
  "direction": "outbound",
  "channel": "whatsapp",
  "contact": {
    "id": "b2e4d6f8-1a3c-4e5f-8a9b-0c1d2e3f4a5b",
    "phone": "+919800000001",
    "name": "Asha"
  },
  "type": "template",
  "text": null,
  "template": { "name": "order_update", "language": "en" },
  "status": "sent",
  "error": null,
  "createdAt": "2026-11-27T10:15:01.000Z"
}
FieldWhat it is
idThe message's id
directioninbound (from the contact) or outbound (from your business)
channelWhere it was sent, such as whatsapp
contactThe contact's id, phone and name (either can be null)
typeThe kind of message, such as text, template or image
textThe message's text, or null
templateThe template's name and language when it was one, else null
statusreceived for a message from the contact; otherwise pending, sent, delivered, read or failed
errorWhy it failed, when status is failed
createdAtWhen it was made, as an ISO time

The api sends WhatsApp text and templates only. Files, buttons and lists cannot be sent through it.

How Inbox works in the app: Platform docs