Skip to content
PaalChat Docs

Get started

Quickstart

Make your first authenticated request, connect a customer and send a template message.

.md

In a nutshell

Register your customer as a business, send their admin to the connect link, then send an approved template with a reference. Everything else arrives as callbacks.

Before you start

You need a product token from a PaalChat operator. It is shown once - put it in your server's secret store, for example PAALCHAT_TOKEN.

Warning

Never use the token in a browser, mobile app or public repository. All calls to PaalChat must come from your server.

1. Check the token

curl https://whatsapp.paaltech.org/api/v1/me \
  -H "Authorization: Bearer $PAALCHAT_TOKEN" \
  -H "Accept: application/json"

The response names your product and the token's abilities:

JSON
{"data": {"product": "multi-skuul", "name": "Multi-SKUUL",
  "token": {"name": "production", "abilities": ["businesses.read", "businesses.write", "connections.read", "connections.manage", "templates.read", "messages.read", "messages.send"], "expires_at": null}}}

2. Register a customer as a business

Use your own ID for the customer as external_id. Calling it again updates the business.

curl -X POST https://whatsapp.paaltech.org/api/v1/businesses \
  -H "Authorization: Bearer $PAALCHAT_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"external_id": "presec", "name": "Presec Legon", "email": "info@presec.edu.gh"}'

3. Connect their WhatsApp

Ask for a one-time link and redirect the customer's administrator to it.

curl -X POST https://whatsapp.paaltech.org/api/v1/businesses/presec/whatsapp/connect \
  -H "Authorization: Bearer $PAALCHAT_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"return_url": "https://presec.skuuls.paaltech.org/settings/whatsapp"}'

The admin logs in to Meta on PaalChat's page and picks a number. You receive a whatsapp.connection callback with "event": "connected". See Connect WhatsApp.

4. Send a template

Business-initiated messages must use an approved template. Always send your own reference.

curl -X POST https://whatsapp.paaltech.org/api/v1/businesses/presec/messages \
  -H "Authorization: Bearer $PAALCHAT_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{
    "to": "+233241234567",
    "type": "template",
    "reference": "skuul-msg-8812",
    "template": {"name": "fees_reminder", "language": "en_US",
      "components": [{"type": "body", "parameters": [
        {"type": "text", "text": "Mrs Mensah"}, {"type": "text", "text": "Kofi"},
        {"type": "text", "text": "450.00"}, {"type": "text", "text": "30 October"}]}]}
  }'

202 Accepted means the message is queued. 200 OK means that reference was already sent - you get the original message back and nothing is sent twice.

5. Receive callbacks

A PaalChat operator registers your callback URL and gives you a signing secret. You will receive message.status as the message is sent, delivered and read, and message.received when the parent replies. Verify every callback - see Callbacks.

Next steps