Skip to main content
WG Messaging Guides

Send your first message

This walkthrough sends an approved template from your backend.

Prerequisitesโ€‹

Set WG_API_BASE_URL and WG_PARTNER_KEY in your backend environment. Never place the partner key in browser code.

Queue the template messageโ€‹

Save the following as message.json. Replace the sender and recipient placeholders. The recipient must contain E.164 digits only, without +, spaces or dashes (at most 15 digits). This example matches the order_update body template in the previous guide; use it only after that exact name/language is approved.

{
"phone_number_id": "YOUR_PHONE_NUMBER_ID",
"recipient": "RECIPIENT_DIGITS",
"type": "template",
"template": {
"name": "order_update",
"language": {"code": "en_US"},
"components": [{
"type": "body",
"parameters": [{"type": "text", "text": "10482"}]
}]
}
}

Choose a unique WG_IDEMPOTENCY_KEY for this logical send and persist it with the request before sending:

curl --request POST "$WG_API_BASE_URL/partner/v1/messages" --header "Authorization: Bearer $WG_PARTNER_KEY" --header "Idempotency-Key: $WG_IDEMPOTENCY_KEY" --header "Content-Type: application/json" --data-binary @message.json

Reuse the same key and unchanged body if the HTTP response is lost. A new key may create a second message. See Send a message for the complete request contract.

Confirm the outcomeโ€‹

202 Accepted means queued, not delivered. Persist message_id and correlation_id. Read GET /partner/v1/messages/{message_id} and save provider_message_id when available. Reconcile this with webhook status events.

A payment or policy problem can appear after acceptance. Local dispatch failures and expiry do not guarantee a Meta callback, so continue status inspection for unresolved messages. Never automatically resend an outcome_unknown message.

Next: Message and webhook delivery and Errors and retries.