Skip to content
View as Markdown

Quickstart

Send a WhatsApp message and watch it get delivered, in about five minutes, without touching a real customer. Everything below uses a test key: the platform simulates WhatsApp, so nothing is sent and nothing is billed.

1. Create a test key#

In the portal, open Settings → Developers → API keys, choose Test, and create a key. Copy it now: it is shown once.

Terminal
export API_KEY="sk_test_..."

Check that it works:

Shell
curl https://api.saei.automize.sa/v1/me -H "Authorization: Bearer $API_KEY"

You get your workspace, "livemode": false, and the scopes of the key.

2. Send a message#

Send a text to the magic test number +966500000001:

Shell
curl -X POST https://api.saei.automize.sa/v1/messages \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+966500000001",
    "type": "text",
    "text": { "body": "Your order is ready for pickup 🎉" },
    "reference": "order-10482"
  }'

The answer comes back at once with "status": "accepted" and an id like msg_test_01j9…. Over the next few seconds the simulator moves it to sent, delivered and read:

Shell
curl https://api.saei.automize.sa/v1/messages/msg_test_01j9... -H "Authorization: Bearer $API_KEY"

3. Receive events instead of polling#

Polling tells you the status when you ask. Webhooks tell you the moment it changes. Add an endpoint that listens for message events:

Shell
curl -X POST https://api.saei.automize.sa/v1/webhook_endpoints \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhooks/whatsapp",
    "enabled_events": ["message.sent", "message.delivered", "message.read", "message.failed", "message.received"]
  }'

Store the secret from the response (whsec_…); it is shown once. Send another message and your server receives message.sent, message.delivered and message.read, each signed. Verify every signature before you trust the body.

4. Go live#

When your integration handles the test flow, create a live key. The same requests now reach real customers through your connected WhatsApp number. Two rules from WhatsApp apply:

  • A free-form message (like the text above) is only delivered within 24 hours of the customer's last message. To start a conversation, send an approved template.
  • Business-initiated templates need the customer's consent. If the contact has not agreed, the API answers recipient_not_consented until you confirm with "consent_confirmed": true.

Read Going live for the full checklist.