# Quickstart

Send your first WhatsApp message through Vesper Relay in about ten minutes. You can do steps 1 to 4 before any number is connected, with a test key.

Base URL: `https://relay.vesperai.ch/api/v1`. Every request carries `Authorization: Bearer <key>`.

## 1. Create a key

In the dashboard open **Settings → API keys** and create a key. Pick **Test** to start: test keys (`vr_test_…`) run every endpoint without reaching Meta. Live keys (`vr_live_…`) send real messages. Keys are shown once; Relay stores only a hash.

## 2. Set your webhook

In **Settings → Your webhook** enter an `https://` URL and save. Relay sends a signed `relay.ping` right away and shows whether your endpoint answered 2xx. Verify signatures as described in [Webhooks](/docs/webhooks).

## 3. Send a message

```bash
curl -X POST https://relay.vesperai.ch/api/v1/messages \
  -H "Authorization: Bearer $RELAY_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: booking-4711-reminder" \
  -d '{"to": "+41 79 123 45 67", "template": "termin_erinnerung", "language": "de",
       "params": ["Max", "Dienstag, 14.10.", "09:00"]}'
```

```python
import httpx
r = httpx.post("https://relay.vesperai.ch/api/v1/messages",
               headers={"Authorization": f"Bearer {key}", "Idempotency-Key": "booking-4711-reminder"},
               json={"to": "+41 79 123 45 67", "template": "termin_erinnerung", "language": "de",
                     "params": ["Max", "Dienstag, 14.10.", "09:00"]})
print(r.status_code, r.json())  # 202 {"id": 1, "wa_message_id": "wamid.…", "status": "accepted", ...}
```

```javascript
const r = await fetch("https://relay.vesperai.ch/api/v1/messages", {
  method: "POST",
  headers: { "Authorization": `Bearer ${key}`, "Content-Type": "application/json",
             "Idempotency-Key": "booking-4711-reminder" },
  body: JSON.stringify({ to: "+41 79 123 45 67", template: "termin_erinnerung", language: "de",
                         params: ["Max", "Dienstag, 14.10.", "09:00"] }),
});
console.log(r.status, await r.json());
```

With a test key the answer has `"mode": "test"`, and your webhook receives `sent`, `delivered` and `read` statuses within seconds.

## 4. Receive a reply

In test mode, simulate a customer answering:

```bash
curl -X POST https://relay.vesperai.ch/api/v1/test/inbound \
  -H "Authorization: Bearer $RELAY_TEST_KEY" -H "Content-Type: application/json" \
  -d '{"from": "+41 79 123 45 67", "text": "Passt, bis Dienstag"}'
```

Your webhook gets a `messages` event in Meta's own shape. Live, the same event arrives when a customer writes to the shop's number.

## 5. Go live

- Connect the shop's number in the dashboard (or send the shop an [onboarding link](/docs/onboarding-links)). The number keeps working in the WhatsApp Business app.
- Create the templates you use under **Templates** or with `POST /api/v1/templates`; Meta reviews them, usually within minutes.
- Swap the test key for a live key.

## Go-live checklist

- Webhook endpoint answers 2xx within 8 seconds and verifies the signature.
- You deduplicate events on the message id (`entry[].changes[].value.statuses[].id` or `messages[].id`); deliveries can repeat and arrive out of order.
- Every send carries an `Idempotency-Key` derived from your booking id, so a retried job never texts twice.
- You handle `429` with `Retry-After`, and Meta errors marked `"retryable": true`.
- Templates are approved for every language you send.
- The shop knows to open the WhatsApp Business app at least every 14 days ([Coexistence](/docs/coexistence)).
