WhatsApp

Send messages, templates, and media through the WhatsApp Business API.

CommunicationAPI key3 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (3)
  4. send-template-message
  5. sendMedia
  6. sendMessage
  7. Details

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.

Workflow
// 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);
});
Try it from your agent
{
  "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"
  }
}
From another backend (connector proxy)
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.

InputTypeDescription
phone_number_idrequiredid (picked from your account)Phone number ID that will be used to send the message.
torequiredtextRecipient phone number.
message_template_idrequiredid (picked from your account)Message Template ID
message_template_fieldsrequiredobject (depends on other props)Template Fields

sendMedia

Send Media. Send a media message through WhatsApp

Also accepted as send_media.

InputTypeDescription
phone_number_idrequiredid (picked from your account)Phone number ID that will be used to send the message.
torequiredtextThe recipient of the message
typerequiredid (picked from your account)The type of media to send
mediarequiredtextThe URL of the media to send
captionoptionallong textA caption for the media
filenameoptionallong textFilename of the document to send

sendMessagebuilt in

Send Message. Send a text message through WhatsApp

Also accepted as send_message.

InputTypeDescription
phone_number_idrequiredid (picked from your account)Phone number ID that will be used to send the message.
torequiredtextThe recipient of the message
textrequiredlong textThe 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