API campaigns

An API campaign is a name you file sends under, so that "order confirmations" has its own report, and the workspace can change its template without you shipping code.

Create one in the dashboard

Go to Campaigns, API Campaigns, create a campaign, give it a name such as appointment_confirmations and pick its template. There is no endpoint to create one, so a typo in your code cannot quietly start a second campaign.

Send under it

Pass campaignName to Send a template message. You can leave out templateName; the campaign supplies it. Everything else is the same as any template send: positional or named variables, headerMediaUrl for an image, video or document header, and buttons for a link button. This one fills named variables and an image header:

# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl -X POST "https://api.wamafy.com/api/v1/public/messages" \
  -H "Authorization: Bearer $WAMAFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+919876543210",
  "campaignName": "appointment_confirmations",
  "headerMediaUrl": "https://wamafy.com/smoke/sample.png",
  "variables": {
    "customer_name": "Priya",
    "date": "12 October",
    "time": "4:30 PM",
    "host": "Dr Rao"
  }
}'

What to expect

SituationResult
No campaign by that name, or it was deleted404, nothing sent
The campaign is paused400, nothing sent. Pausing is how the workspace stops an integration.
You pass a templateName that differs from the campaign's400, naming the campaign's template
Neither campaignName nor templateName422

The report, with its delivery funnel, daily chart and each failed recipient with WhatsApp's reason, is in the dashboard under the campaign. Each API campaign counts once towards your monthly campaign allowance, like a broadcast; the messages sent under it count towards your message allowance as usual.

    API campaigns - Wamafy API