WhatsApp Cloud API
Send text, templates, media and interactive messages, manage templates and the profile
Beta v0.4.0 Node.js 19 actions ToS risk low
About
A Graphrt plugin for the official WhatsApp Business Cloud API. It sends messages from a business phone number and manages media, message templates and the business profile. Every operation is a workflow node. Agent tools are limited by the agent policy.
What it can do
- Messaging: text (with link preview and quote-reply), approved templates, media (image, video, audio, document, sticker), location, reply buttons, lists, reactions, and marking messages as read (with an optional typing indicator)
- Media: upload from an https URL (checked against WhatsApp's types and size limits), get a media download URL, delete media
- Templates: list, get, create (submit for review) and delete templates on the WhatsApp Business Account
- Account: list the account's phone numbers, read and update a number's business profile
- api_request: any other Graph endpoint, restricted to graph.facebook.com
- Phone numbers are validated as international E.164 numbers before anything is sent
- Clear error kinds for WhatsApp's error codes. Tokens never appear in errors.
Actions
Each action is a step you can add to a workflow. Agents can also use most of them as tools.
- Send WhatsApp text
whatsapp-api.send_text - Send WhatsApp template
whatsapp-api.send_template - Send WhatsApp media
whatsapp-api.send_media - Send WhatsApp location
whatsapp-api.send_location - Send WhatsApp reply buttons
whatsapp-api.send_interactive_buttons - Send WhatsApp list
whatsapp-api.send_interactive_list - Send WhatsApp reaction
whatsapp-api.send_reaction - Mark WhatsApp message as read
whatsapp-api.mark_as_read - Upload WhatsApp media
whatsapp-api.upload_media - Get WhatsApp media URL
whatsapp-api.get_media_url
Show all 19 actions
- Delete WhatsApp media
whatsapp-api.delete_media - List WhatsApp templates
whatsapp-api.list_templates - Get WhatsApp template
whatsapp-api.get_template - Create WhatsApp template
whatsapp-api.create_template - Delete WhatsApp template
whatsapp-api.delete_template - List WhatsApp phone numbers
whatsapp-api.list_phone_numbers - Get WhatsApp business profile
whatsapp-api.get_business_profile - Update WhatsApp business profile
whatsapp-api.update_business_profile - WhatsApp Cloud API (Graph) request
whatsapp-api.api_request
Settings
Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.
-
WHATSAPP_ACCESS_TOKENRequiredSystem-user (or other) access token -
WHATSAPP_PHONE_NUMBER_IDFor messaging, media upload and profileSending phone number id (not the phone number itself) -
WHATSAPP_BUSINESS_ACCOUNT_IDFor templates and list_phone_numbersWhatsApp Business Account id -
WHATSAPP_GRAPH_VERSIONOptionalGraph API version, default v26.0 -
WHATSAPP_TOOL_ALLOW_SENDOptional1 lets agent tools send messages (see Agent policy). Workflow nodes don't need it -
WHATSAPP_TOOL_RECIPIENT_ALLOWLISTWith WHATSAPP_TOOL_ALLOW_SENDComma-separated numbers agent tools may message: full E.164 numbers (+6281234567890, matched exactly) or prefixes with at least 4 digits (+62812*). Unset refuses every agent send -
WHATSAPP_TOOL_ALLOW_PROFILEOptional1 lets agent tools update_business_profile (the public business profile) -
WHATSAPP_TOOL_ALLOW_TEMPLATESOptional1 lets agent tools create_template (templates can later be broadcast) -
WHATSAPP_TOOL_SEND_RATE_LIMITOptionalMost messages agent tools may send per minute from this plugin process, default 20, 0 turns the client-side limits off (see Rate limits). Workflow nodes are not limited
How to use it
In Graphrt Desktop
- Open Plugins and search for WhatsApp Cloud API.
- Click Install and approve it.
- Follow the setup steps on the plugin's page, then paste the settings it needs.
- Describe a job that needs it, and the builder adds the steps.
With the CLI
terminal
$ graphrt plugin install whatsapp-api workflow.yaml
- id: welcome
type: whatsapp-api.send_template
to: "{{#start.phone#}}"
name: order_update
language: id
components: '[{"type":"body","parameters":[{"type":"text","text":"{{#start.order_id#}}"}]}]'
- id: menu
type: whatsapp-api.send_interactive_buttons
to: "{{#start.phone#}}"
body: "Ada yang bisa kami bantu?"
buttons: '["Status pesanan", "Bicara dengan CS"]'