Send messages, templates, and media through the WhatsApp Business API.
On this page
Connect
Auth type: API key (secret_text). Pass the provider's API key or token as the connection's credential. It is sealed at rest and only opened on the server when an action runs.
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("whatsapp", action, input) resolves with the provider's answer and rejects when WhatsApp isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. sendMessage runs in the platform itself; the other actions run through the integration runner, which the server's operator turns on.
// workflows/notify.ts: call WhatsApp when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellWhatsapp = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when WhatsApp isn't connected.
const output = await step.run("WhatsApp", () =>
step.ctx.integrations.invoke("whatsapp", "send-template-message", {
"phone_number_id": "<phone_number_id>",
"to": "<to>",
"message_template_id": "<message_template_id>",
"message_template_fields": {}
}),
);
step.ctx.log("WhatsApp answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "whatsapp",
"piece_action": "send-template-message",
"input": {
"phone_number_id": "<phone_number_id>",
"to": "<to>",
"message_template_id": "<message_template_id>",
"message_template_fields": {}
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/whatsapp/send-template-message" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"phone_number_id":"<phone_number_id>","to":"<to>","message_template_id":"<message_template_id>","message_template_fields":{}}}'Actions
send-template-message
Send Template Message. Sends a template message.
Also accepted as send_template_message.
| Input | Type | Description |
|---|---|---|
phone_number_idrequired | id (picked from your account) | Phone number ID that will be used to send the message. |
torequired | text | Recipient phone number. |
message_template_idrequired | id (picked from your account) | Message Template ID |
message_template_fieldsrequired | object (depends on other props) | Template Fields |
sendMedia
Send Media. Send a media message through WhatsApp
Also accepted as send_media.
| Input | Type | Description |
|---|---|---|
phone_number_idrequired | id (picked from your account) | Phone number ID that will be used to send the message. |
torequired | text | The recipient of the message |
typerequired | id (picked from your account) | The type of media to send |
mediarequired | text | The URL of the media to send |
captionoptional | long text | A caption for the media |
filenameoptional | long text | Filename of the document to send |
sendMessagebuilt in
Send Message. Send a text message through WhatsApp
Also accepted as send_message.
| Input | Type | Description |
|---|---|---|
phone_number_idrequired | id (picked from your account) | Phone number ID that will be used to send the message. |
torequired | text | The recipient of the message |
textrequired | long text | The message to send |
Details
- Id
whatsapp- Category
- Communication
- Tags
- messaging, chat, mobile, business
- Package
@activepieces/piece-whatsapp@0.2.3- Runs
- sendMessage in the platform; the rest through the integration runner