This guide shows the Option B receipt pattern: the WhatsApp message includes a PDF document header and body variables describing the receipt.
Use this pattern when the customer should receive the receipt document directly in WhatsApp instead of opening a receipt page.
Before you start
You need:
- A connected WhatsApp channel in Switchbord.
- An approved Utility template with a
DOCUMENT header, for example payment_receipt_document.
- A public HTTPS PDF URL. Meta must be able to fetch it.
- A stable upstream event id for idempotency.
The document URL must be HTTPS and reachable by Meta. Do not use internal-only URLs, localhost, expiring URLs that expire before dispatch, or URLs containing reusable secrets.
Template shape
A typical document receipt template has a document header and a body like:
The document header receives:
Direct API send
Expected response:
Inbound webhook builder
To map an external payment event into this template:
- Open Settings → Integrations → Webhooks & API.
- Create a new inbound webhook.
- Select the approved
payment_receipt_document Utility template.
- Map the fields:
- Paste a sample payload and run the dry-run preview.
- Create the webhook. New configs stay disabled and dry-run by default until live promotion is supported.
Sample payload:
Named body variables
Switchbord’s inbound webhook mapper and internal transactional compiler support Meta named body parameters and compile them into parameter_name entries. The public POST /api/v1/template-sends route currently accepts positional body variables only, so direct API callers should use numeric body keys or an array.
Validation
Switchbord validates the document header before queueing:
link must be a valid HTTPS URL.
filename, when supplied, must be non-empty.
- Required body variables must resolve to non-empty strings.
- The selected template must be approved Utility.
- The idempotency key must be stable for retries.
Troubleshooting