Send a campaign
Send an approved template to your WhatsApp contacts and choose the agent that will handle replies. Check recipients, message and cost in the preview before confirming the send. Then read the campaign's results.
Before you start
You need:
- An approved WhatsApp template.
- A published agent to handle replies. Save its id in
AGENT_ID. - The sending number's
prefixedChannelIdinCHANNEL_ID. The number must belong to the same WhatsApp account as the template.
To use the platform, see Campaigns.
Create the campaign
Give it a title and the template it sends. The title is unique in the workspace. (Create a campaign)
curl https://api.platic.ai/v1/campaigns \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Spring sale", "category": "marketing", "templateName": "spring_sale", "language": "es_MX" }'import { Platic } from "platic-sdk"; const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! }); const campaign = await platic.campaigns.create({ title: "Spring sale", category: "marketing", templateName: "spring_sale", language: "es_MX", });Create a marketing campaign called Spring sale with the spring_sale template in Spanish (Mexico).
Tool:
create_campaign.Save the campaign's
idinCAMPAIGN_ID.categoryacceptsmarketingorutility. Uselanguageto choose the template's language; the response shows the saved language. A missing template returnsTEMPLATE_NOT_FOUND. A template that isn't approved returnsTEMPLATE_NOT_APPROVED.If the template's button leads to your site, set where it goes with Update a campaign (
ctaTargetUrl). Every recipient gets their own link, and the click and the purchase are measured.Build the audience
Add contacts (
clientsin the API) by phone number, or all at once from a contact search, a tag or a list of ids. Contacts that don't exist in the workspace are created. (Add audience)curl https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/audience \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "clients": [ { "phoneNumber": "5215512345678", "name": "Ana" }, { "phoneNumber": "5215587654321", "name": "Luis" } ] }'const campaignId = campaign.id; await platic.campaigns.audience.add(campaignId, [ { phoneNumber: "5215512345678", name: "Ana" }, { phoneNumber: "5215587654321", name: "Luis" }, ]);Add to the Spring sale campaign every contact with the tag customers.
Tool:
add_campaign_audience. To find contacts first it usessearch_clients.Send exactly one source:
clients,searchId,tagorclientIds(up to 5,000). WithdryRun: trueit only says how many would join, without changing the audience. To see or remove people, use Get the audience, Remove from the audience and Clear the audience.Define a goal
Define the result you want to measure, such as "Asked for a quote". The report counts campaign conversations that meet that criterion. (Goals)
curl -X POST https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/goals \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Asked for a quote", "criteria": "The customer asks about a price or asks for a quote." }'const goal = await platic.campaigns.goals.create(campaignId, { name: "Asked for a quote", criteria: "The customer asks about a price or asks for a quote.", });In the Spring sale campaign, count it as achieved when the customer asks for a price or a quote.
Tool:
create_campaign_goal.If the campaign already has a goal with that name, no other is created: the response is
200with that goal andalreadyExisted: true. To change its criteria, update it with Goals.Preview the send
Generate a preview first. Without sending messages, it shows the recipients, sending number, message with real data, cost and who will respond.
Set who handles replies (
replyHandling), the sending number (senderChannelId) and the template's values (variables). (Send a campaign)curl -X POST https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/send/preview \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "replyHandling": "agent", "responderAgentId": "'"$AGENT_ID"'", "senderChannelId": "'"$CHANNEL_ID"'", "variables": ["client_firstname"] }'const decisions = { replyHandling: "agent", responderAgentId: process.env.AGENT_ID!, senderChannelId: process.env.CHANNEL_ID!, variables: ["client_firstname"], } as const; const preview = await platic.campaigns.previewSend(campaignId, decisions); console.log(preview.resumen, preview.avisos);Prepare the send of the Spring sale campaign from my WhatsApp number. Have the Sales agent answer and use each contact's name in the message.
Tool:
preview_campaign_sendand shows you the result before sending.Check
resumen,mensaje,variables_sin_resolverandavisos.mensajeshows the variables filled with real contact data. The preview sends no messages and doesn't change the campaign.Blocked contacts and contacts who unsubscribed from marketing are excluded. Each date in
scheduledDatesrepeats the full send to the same audience and incurs another charge.Confirm the send
Send the
confirmationfrom the preview with the same decisions. It is valid for 30 minutes and works for one send. (Send a campaign)curl -X POST https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/send \ -H "Authorization: Bearer $PLATIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "confirmation": "'"$CONFIRMATION"'", "replyHandling": "agent", "responderAgentId": "'"$AGENT_ID"'", "senderChannelId": "'"$CHANNEL_ID"'", "variables": ["client_firstname"] }'if (preview.confirmation) { const sent = await platic.campaigns.send(campaignId, { ...decisions, confirmation: preview.confirmation }); console.log(sent.runId); }Yes, send it.
Tool:
send_campaignwith theconfirmationfrom the preview.Save the response's
runId. It confirms that the send is queued; messages go out afterwards. Use the funnel in the next step to check progress without repeating the send call.If something changed since the preview (the audience, the template or the link's destination), nothing is sent and the response is
409with what changed: ask for another preview. Aconfirmationthat was already used also answers409.ImportantFrom the API, fewer than 5,000 messages go out per campaign every 24 hours, counting sends and scheduled dates. If the preview goes over that, it arrives with
requiere_autorizacion: trueand noconfirmation: a person launches that send from the campaign's board.Read the results
The funnel counts distinct people at every step of each send (sent, delivered, read, clicks and purchases). The report covers a period: conversations, messages per day and how many met each goal. (Results)
curl https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/funnel \ -H "Authorization: Bearer $PLATIC_API_KEY" curl "https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/report?startDate=2026-11-01&endDate=2026-11-30" \ -H "Authorization: Bearer $PLATIC_API_KEY"const funnel = await platic.campaigns.funnel(campaignId); for (const run of funnel.data.runs) console.log(run.runId, run.funnel, run.rates); const report = await platic.campaigns.report(campaignId, { startDate: "2026-11-01", endDate: "2026-11-30" }); console.log(report.metrics, report.goals);How is the Spring sale campaign doing?
Tool:
get_campaign_funnelandget_campaign_report.Each metric requires its event: a click without a read receipt does not count as read. Amounts are in cents. If you omit dates, the report covers the current month in Mexico City time. Use Export recipients to download the recipients of a send as CSV.
Check it worked
Find your runId in the funnel and check that the sent count increases. When a contact replies, check the inbox to confirm that the conversation is assigned to the agent you chose.
Next steps
- Hand a conversation to your team when a contact needs a person.
- Receive webhooks to follow replies and message events in your own system.
- Campaigns: every endpoint, with its limits.