WhatsApp Campaigns

v0.1.11
com.wa-campaigns/whatsapp-campaigns Checked 3 days ago Published 26 days ago

Send WhatsApp campaigns: templates, audiences, surveys, inbox replies, delivery webhooks.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

capabilities

Describe the gateway: tool catalog, the scopes this key holds, and pricing posture. Call first to plan what you may do.

search_templates

Search the published template MARKETPLACE (templates from every org, to clone). Returns normalized listings (id, name, rating, cloneCount, categoryKeys). For your OWN templates use list_templates.

ParameterTypeDescription
categorystringMarketplaceCategory key, e.g. EVENTS.
channelstring
pagenumber
pageSizenumber
qstringFree-text search over name + description.
sortstring

list_templates

List YOUR org's own message templates (not the marketplace), newest first, with channel and provider approval status (APPROVED / PENDING / REJECTED / NOT_SUBMITTED) and any rejection reason. Filter by text, channel or approvalStatus. Archived templates only with includeArchived.

ParameterTypeDescription
approvalStatusstringOnly templates in this provider approval state.
channelstring
includeArchivedboolean
pagenumber
pageSizenumber
qstringFree-text search over name + description.

get_template

Fetch one template by id (a published marketplace listing or one your org owns).

ParameterTypeDescription
id *string

render_template

Validate a template and return the rendered RCS payload + variable-bound SMS/MMS fallback, without sending. Use to inspect before cloning/sending.

ParameterTypeDescription
id *string
variablesobjectMerge fields ({{key}} -> value) to bind into the preview.

create_template

Create a template draft in your org. Compose a TemplateContent (text/card/carousel) with a REQUIRED non-empty smsFallback; the shared RCS validator gates it. Submit it (submit_template) and await provider approval before send_message for rich RCS; an unsubmitted template delivers as SMS fallback.

ParameterTypeDescription
content *objectTemplateContent. Must include a non-empty smsFallback. One of text/card/carousel is the primary body.
name *string
categorystring
channelstring
descriptionstring
tagsarray

update_template

Partially update a template your org owns: name, description, category, tags, knowledgeDoc, and content (re-validated by the shared RCS validator — a non-empty smsFallback is still required). Only the fields you pass change. Editing the CONTENT of an already-approved template invalidates that approval: submit_template it again and await approval, or it delivers as SMS fallback until then. Use get_template first to edit incrementally rather than overwriting blind.

ParameterTypeDescription
id *string
categorystring
channelstringMove the template to another channel. Requires the matching add-on brand; omit to leave it where it is.
contentobjectFull replacement TemplateContent (not a deep merge). Must include a non-empty smsFallback.
descriptionstring
knowledgeDocstring
namestring
tagsarray

duplicate_template

Duplicate a template your org OWNS into a fresh private draft (e.g. to iterate a variant without touching the original). The copy keeps the content, channel, category, tags and knowledge base, but starts unsubmitted — it has no provider approval of its own until you submit_template it. For copying someone else's PUBLISHED marketplace listing, use clone_template instead.

ParameterTypeDescription
id *string

delete_template

Delete a template your org owns. IRREVERSIBLE, and it also removes the template from the provider (Twilio), so an approved template loses its approval and can no longer be sent. Broadcasts that already went out are unaffected. Prefer this only for drafts and abandoned iterations; ask the user before deleting anything they have submitted or sent.

ParameterTypeDescription
id *string

clone_template

Clone a published marketplace template into your org as a fresh private draft. Returns the new template. To deliver rich RCS rather than SMS fallback, submit_template it and await provider approval before send_message.

ParameterTypeDescription
id *string

submit_template

Submit an org-owned template to the provider (Twilio) for approval. Returns the contentSid + approval status.

ParameterTypeDescription
id *string

send_message

Send an org-owned template to a list of E.164 phone numbers (RCS-first with mandatory SMS/MMS fallback). Pass the template's blueprintId or id. The template sends as rich RCS only after submit_template + provider approval; until then it delivers as SMS fallback — the returned funnel's `fellBackToSms` count signals how many recipients got SMS instead of RCS. Bills your org. Returns the send funnel.

ParameterTypeDescription
blueprintId *string
to *array
namestring
variablesobject

search_surveys

List/search the surveys your org owns. Returns each survey with its recipients + responses counts.

ParameterTypeDescription
pagenumber
pageSizenumber
qstringFree-text search over the name.
statusstring

get_survey

Fetch one survey your org owns by id (its full definition).

ParameterTypeDescription
id *string

render_survey

Preview a survey the way a respondent sees it: the text body + RCS chip titles for each question. Side-effect-free.

ParameterTypeDescription
id *string

create_survey

Create a survey draft in your org. Provide a SurveyDefinition (intro? + questions[] of type rating/single_select/text/comment); the shared validator gates it. PICTURES: every question should carry an `imageUrl`, and the definition should carry `headerImageUrl` (start picture) and `outroImageUrl` (finish picture). If the user provided no pictures, WEB-SEARCH for suitable, relevant images first and pass their https URLs — the server automatically re-hosts every image onto the platform GCS bucket, so external URLs are safe to pass and never hotlinked.

ParameterTypeDescription
definition *objectSurveyDefinition: { intro?, outro?, questions: [{ questionId, prompt, type, options?, minRating?, maxRating?, required? }] }.
name *string
channelstringChannel to act on (RCS or WHATSAPP). Defaults to your org's own brand channel; any other channel requires the matching add-on brand.
descriptionstring
endDatestring
isPreferencesSurveyboolean
languageCodearray
startDatestringISO date; schedules the survey.
timezonestring

clone_survey

Duplicate an org-owned survey into a fresh DRAFT (e.g. to iterate a variant). Returns the new survey.

ParameterTypeDescription
id *string

delete_survey

Delete a survey your org owns. IRREVERSIBLE: its responses and sessions are deleted with it, so any results you have not already read are lost. Ask the user before deleting a survey that has been sent or has responses — read get_results first if in doubt.

ParameterTypeDescription
id *string

submit_survey

Submit a survey for provider approval: on RCS its button-question templates, on WhatsApp its single Flow template. Returns the survey with the resulting approval state.

ParameterTypeDescription
id *string
channelstringChannel to act on (RCS or WHATSAPP). Defaults to your org's own brand channel; any other channel requires the matching add-on brand.

send_survey

Send a survey to explicit E.164 numbers (the CRM-triggered single-customer send) and/or saved audiences. Flips the survey ACTIVE. Bills your org. Returns { recipients, sent }. Every send is a campaign (WhatsApp sends the approved Flow, RCS the question-by-question run) and also returns campaignId and queued: sending: true means the rest is still going out in the background (do not send again), and halted / heldByAllowance / groundStopped say why a send stopped short.

ParameterTypeDescription
id *string
audienceIdsarray
channelstringChannel to act on (RCS or WHATSAPP). Defaults to your org's own brand channel; any other channel requires the matching add-on brand.
toarrayE.164 destinations, e.g. ["+15551234567"].

update_survey

Partially update a survey: name, description, definition (re-validated; editing a submitted WhatsApp survey requires resubmission), startDate/endDate, and audienceIds — setting audienceIds on a future-dated survey schedules the send to fire automatically at startDate. PICTURES: as with create_survey, keep every question's `imageUrl` plus `headerImageUrl`/`outroImageUrl` populated — web-search for images when none were provided; the server re-hosts all image URLs onto GCS.

ParameterTypeDescription
id *string
audienceIdsarray
channelstringChannel to act on (RCS or WHATSAPP). Defaults to your org's own brand channel; any other channel requires the matching add-on brand.
definitionobject
descriptionstring
endDatestring
namestring
startDatestring
statusstring

list_survey_sends

A survey's outbound send log (live + test sends), newest first, with per-message delivery status — including failed/stubbed attempts and the reason they did not deliver.

ParameterTypeDescription
id *string

send_survey_test

Send a one-off TEST of the survey to a single E.164 number (does not change status or audiences). Check list_survey_sends afterwards for the delivery outcome.

ParameterTypeDescription
id *string
number *stringE.164, e.g. +15551234567.
channelstringChannel to act on (RCS or WHATSAPP). Defaults to your org's own brand channel; any other channel requires the matching add-on brand.

get_results

Read a survey’s aggregated results: per-question option counts / rating averages / text samples + completion totals (multi-part questions aggregate per part; free-text answers are auto-translated to English). Pass campaignId (returned by send_survey, or a SURVEY campaign’s id from list_campaigns) for that one send’s results; without it the totals span the whole survey, test sends and every campaign included.

ParameterTypeDescription
id *string
campaignIdstringOnly the responses answered from this survey campaign (24-hex id). A campaign that is not this survey’s is a 404.

upload_media

Store one picture on the platform GCS bucket and get its stable https URL — the only kind of URL survey/template media should use. Pass EITHER the image inline (base64 + mime) OR an https sourceUrl the server fetches and re-hosts (use this for web-searched pictures).

ParameterTypeDescription
base64stringRaw base64 or data: URL of the image bytes.
filenamestring
mimestringImage MIME type (required with base64), e.g. image/png.
sourceUrlstringhttps image URL to fetch and re-host onto GCS.

get_knowledge

Read a template's knowledge base: the grounding document text plus whether answering is enabled. Use before set_knowledge to edit a doc incrementally instead of overwriting it blind.

ParameterTypeDescription
id *string

set_knowledge

Set/replace a template's knowledge base: the grounding document AI answers are generated from when recipients reply. Include operating instructions in the doc itself — e.g. "Any question not answered by this document must be answered exactly: …". Setting a doc re-enables answering.

ParameterTypeDescription
doc *stringThe knowledge document (markdown or plain text).
id *string

delete_knowledge

Delete a template's knowledge base document.

ParameterTypeDescription
id *string

enable_knowledge

Enable knowledge answering on a template (the doc is used again).

ParameterTypeDescription
id *string

disable_knowledge

Disable knowledge answering on a template WITHOUT deleting the doc (pause).

ParameterTypeDescription
id *string

get_usage

Read your org’s month-to-date metered message usage.

search_audiences

List/search the audiences (saved contact lists) your org owns. Returns each audience with its name, source, and contactCount.

ParameterTypeDescription
pagenumber
pageSizenumber
qstringFree-text search over the name.

get_audience

Fetch one audience your org owns by id.

ParameterTypeDescription
id *string

list_audience_contacts

Paginated list of an audience's contacts. Use `q` to find someone in a large imported batch instead of paging through it — it matches on the server, over the whole audience, so it keeps working on lists too big to page.

ParameterTypeDescription
id *string
pagenumber
pageSizenumber
qstringFree-text over number, names and email. A number matches however it is written — "(206) 300-0001" finds "+12063000001".

create_audience

Create a saved audience (contact list) in your org, optionally seeded with contacts (e.g. leads parsed from a CSV). Every contact needs a reachable E.164-ish `number` — a contact with no valid number fails the whole create with a 400 (fix the row rather than silently dropping it). Use `attributes` for any extra CSV columns you want available as {{key}} merge fields later.

ParameterTypeDescription
name *string
contactsarray
descriptionstring
sourcestringFree-text provenance, e.g. "Jaipur wedding planners leads.csv".

import_contacts

Append contacts to an existing audience (e.g. more leads from a later CSV batch). Same reachability rule as create_audience: every contact needs a valid `number` or the whole import 400s.

ParameterTypeDescription
contacts *array
id *string

update_audience

Rename an audience or change its description (null or an empty string clears it). Only the fields you pass change; its contacts are untouched.

ParameterTypeDescription
id *string
descriptionstring | null
namestring

remove_audience_contacts

Take people off an audience, by each row's `id` from list_audience_contacts (its `contactId` works too). This is not an opt-out: the person, their message history and their other audiences are untouched, and ids not in the audience are ignored. Returns the audience with its new contactCount and how many were removed.

ParameterTypeDescription
contactIds *array
id *string

delete_audience

Delete an audience and all of its contacts (org-scoped, irreversible).

ParameterTypeDescription
id *string

list_conversations

List the org's conversation threads (one per phone number), newest activity first. Archived threads are hidden. Filter by free text, unread, unassigned, a specific assignee, or the campaign a thread was messaged in.

ParameterTypeDescription
assignedTostringOnly threads owned by this Clerk user id.
broadcastIdstringOnly threads this campaign was sent to.
pagenumber
pageSizenumber
searchstringMatch the number or the resolved display name.
unassignedbooleanOnly threads nobody owns.
unreadbooleanOnly threads with unanswered arrivals (unreadCount > 0). Org-wide, not per-viewer: a key is not a person and has no read state.

get_conversation

Read one thread in a single call: its meta, the most recent messages (ascending), the contact summary (marketing status, tags, audiences) and whether the WhatsApp 24h service window is open. Internal team notes are deliberately NOT included.

ParameterTypeDescription
id *string
limitnumberHow many of the most recent messages to include.

reply

Reply into a thread — free text (with an optional image) or an approved template. Reaches a real phone and bills your org. Every gate an operator hits applies unchanged: an opted-out number is refused (409), the org allowance is enforced, WhatsApp free text needs the 24h window open (an approved template otherwise), and an RCS send always carries its SMS fallback. When the thread has an outbound language set, free text is translated into it first, exactly as the human composer does.

ParameterTypeDescription
id *string
kind *string
blueprintIdstringkind=template: the org template to send.
mediaUrlstringkind=text: a public https image URL to attach.
textstringkind=text: the body. May be empty when mediaUrl carries the message.
variablesobjectkind=template: values for the template's {{variables}}.

assign_conversation

Give a thread an owner, or release it back to the pool with `userId: null`. The assignee is a bare Clerk user id and is NOT validated against the org roster — a stale id degrades to "assigned to someone who left", visibly, rather than to an outage in a one-field write.

ParameterTypeDescription
id *string
userId *string | nullClerk user id to hand the thread to; null releases it.

list_webhooks

The org's registered outbound webhook endpoints. The signing secret is redacted — it is shown only once, by create_webhook.

create_webhook

Register an HTTPS endpoint to receive signed platform events. The response carries the signing `secret` EXACTLY ONCE — store it now; every later read redacts it and there is no way to retrieve it again. Each delivery is signed `X-RCS-Signature: t=<unix>,v1=<hex HMAC-SHA256 of "<t>.<rawBody>">`.

ParameterTypeDescription
events *arrayEvent types to subscribe to.
url *stringHTTPS endpoint to POST events to.
descriptionstring

update_webhook

Update an endpoint's url, subscribed events, description, or active flag. Only the fields you pass change. The signing secret is never returned or rotated here.

ParameterTypeDescription
id *string
activeboolean
descriptionstring | null
eventsarray
urlstring

delete_webhook

Remove a webhook endpoint. Its delivery history is deleted with it; anything still queued for it stops.

ParameterTypeDescription
id *string

test_webhook

Fire a synthetic signed event at one endpoint to verify the receiver. Returns the delivery id and whether it was accepted.

ParameterTypeDescription
id *string

list_contacts

Search the org's contact records (one person per number, across every audience). Returns consent, opt-out, number verdict, marketing status, merge fields and tags.

ParameterTypeDescription
audienceIdstringOnly people who are members of this audience.
pagenumber
pageSizenumber
qstringFree-text over number, names and email.
statusstringMarketing status: SUBSCRIBED (consent, not opted out), UNSUBSCRIBED (opted out — sticky), UNDELIVERABLE (number known unreachable), UNKNOWN (no consent on record).
tagstring

get_contact

Fetch one contact by its public contact id, with the audiences they belong to.

ParameterTypeDescription
id *string

update_contact

Correct a contact's names, email, merge fields (`attributes`, a whole-map replace) or tags. Consent and opt-out are deliberately NOT reachable from here — recording or clearing them is a compliance-sensitive action that stays with a human operator.

ParameterTypeDescription
id *string
attributesobject | nullWhole-map replace of the {{merge field}} values.
emailstring | null
firstNamestring | null
lastNamestring | null
tagsarray

list_campaigns

List YOUR org's campaigns (broadcasts), newest first, with status (DRAFT / SCHEDULED / SENDING / SENT / FAILED / CANCELLED), channel, the template sent, audience count, schedule (scheduledAt in the campaign's own timezone) and the delivery funnel (total, delivered, read, failed, fellBackToSms, clicked). Archived campaigns are hidden. Read-only: creating, scheduling or sending a campaign happens in the web app.

ParameterTypeDescription
channelstring
pagenumber
pageSizenumber
qstringFree-text search over the campaign name.
statusstring

get_campaign_analytics

Campaign analytics, the same figures as the web app's Analytics page: totals and rates (delivered, read, clicked, failed, fell back to SMS) over the last N days (default 30, max 365), a daily series (UTC days; hourly for a 1-day window), failure classes by provider error code, after-delivery outcomes (replied, opportunity, not interested) and a per-campaign table. Pass broadcastId (a list_campaigns id) to narrow every figure to one campaign over its own lifetime. Aggregate only — no phone numbers or message text.

ParameterTypeDescription
broadcastIdstringOne campaign (its list_campaigns id).
channelstringOnly this channel. Omit for every campaign.
daysnumber

list_campaign_groups

List YOUR org's campaign groups — named sets of campaigns filed together (an event, a launch, a quarter) — most recently changed first, each with its member campaign ids, campaign count and combined delivery funnel (every member's funnel added together, from cached figures). Pass broadcastId (a list_campaigns id) for only the groups that campaign is in.

ParameterTypeDescription
broadcastIdstringOnly the groups this campaign (a list_campaigns id) is in.

get_campaign_group

One campaign group: its member campaigns (status, channel, schedule and each funnel, refreshed when stale) and their combined funnel. Campaigns deleted since they were filed are left out.

ParameterTypeDescription
id *string

create_campaign_group

Create a campaign group, optionally filing campaigns (list_campaigns ids) in it at once. Names are unique per org, ignoring case and spacing. A group never changes who a campaign reaches or when it sends; a campaign may be in several groups.

ParameterTypeDescription
name *string
broadcastIdsarrayCampaigns (list_campaigns ids) to start the group with.
descriptionstring

update_campaign_group

Rename a campaign group or change its description (null clears it). Only the fields you pass change; use add_campaigns_to_group / remove_campaigns_from_group to change its campaigns.

ParameterTypeDescription
id *string
descriptionstring | null
namestring

delete_campaign_group

Delete a campaign group. Only the group goes: its campaigns, their recipients and their results are untouched.

ParameterTypeDescription
id *string

add_campaigns_to_group

File campaigns (list_campaigns ids) in a campaign group. Idempotent: a campaign already in the group stays where it is. Returns the group with its campaigns.

ParameterTypeDescription
broadcastIds *array
id *string

remove_campaigns_from_group

Take campaigns out of a campaign group. The campaigns themselves are untouched; ids not in the group are ignored. Returns the group with its campaigns.

ParameterTypeDescription
broadcastIds *array
id *string