Guides
Dynamic Invoice Link
SaaS pattern for putting a per-customer HTTPS URL inside the template body text (the customer sees a clickable link). For a native PDF / document bubble instead, use Template Media Headers.
This guide is for text links only
If your approved template header is
DOCUMENT, do not put the PDF URL in body_variables. Pass it as header_media_url (or upload header_media_file) so WhatsApp delivers a file.
Meta formatting rule
Body and header variables cannot be the first or last characters of the text. Always include static text before and after each variable.
When to use this pattern
- Your ERP already hosts a download page or attachment API and you want the customer to open that URL.
- You do not need a native WhatsApp document preview.
- Your template has no DOCUMENT/IMAGE/VIDEO header (or you intentionally keep media static).
1. Create the template (dashboard)
- Open Templates → Create.
- Choose category UTILITY and the language your customers expect.
- Leave the header empty (or use a text header). Do not set header format to DOCUMENT if you want a text link.
- Set a body such as:
Body
Dear Customer, Your invoice: {{1}} Thank you.
- Provide an example value for
{{1}}— any valid HTTPS URL for Meta review. - Submit and wait for Meta approval (usually minutes to 24 hours).
2. Send via API
Pass the full customer-specific URL in body_variables[0].
cURL
curl -X POST "https://app.washeej.com/v1/templates/send" \
-H "client-id: YOUR_CLIENT_ID" \
-H "client-secret: YOUR_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"template_id": "YOUR_TEMPLATE_ID",
"mobile_code": "966",
"mobile": "500000000",
"whatsapp_account_id": YOUR_ACCOUNT_ID,
"body_variables": [
"https://files.example.com/invoices/attachment?id=UUID"
]
}'
Customer receives:
Rendered message
Dear Customer, Your invoice: https://files.example.com/invoices/attachment?id=UUID Thank you.
Alternative: URL button
Keep the body fully static and put the dynamic segment in a URL button path or query string
(for example https://example.com/invoice?id={{1}}). Meta does not allow variables in the domain itself.
Need a native PDF file instead?
Create a template with header format DOCUMENT and follow
Template Media Headers
using header_media_url or header_media_file.