Secure your WhatsApp automations: keys, webhooks and signatures
Secure a WhatsApp automation at four points: the AI key, stored encrypted and used only for AI replies; the webhook an automation calls, which should check an HMAC signature before trusting a request; the forward of incoming messages, signed with a secret you can rotate; and the people and assistants with access, kept to what they need.
easyCoexistence stores your AI keys encrypted and never shows them again, signs every Call my webhook request and every forwarded message with X-EC-Signature using a secret only you hold, and refuses webhook addresses that are not public HTTPS.
Encryption used at rest for saved AI keys, signing secrets and the number's Meta access token.
All you see of a saved AI key again: "ending in" its last four characters.
Randomness in each signing secret: whsec_ followed by 24 random bytes, one per automation and one per forwarding number.
Webhook and Forward URLs must be public HTTPS; private and internal addresses are refused at save and before each send.
Suggested limit on the age of the signature's t value, to refuse replayed requests.
What needs protecting in a WhatsApp automation setup?
Five credentials, each with its own place and its own fix if it leaks. Two of them belong to automations themselves, the AI key and the Call my webhook signing secret; the forward secret belongs to the number; the access token and your assistant's sign-in belong to the account. Knowing which is which tells you what to rotate when something goes wrong.
How are AI keys stored and used?
Only from the dashboard: the AI keys button on the Automations page, then Test and save. The key is first checked against a free endpoint of the provider, which spends no tokens, and a key the provider refuses is discarded without being saved. A working key is encrypted at rest with AES-256-GCM, decrypted only to call that provider for your AI steps and agents, and to write out voice messages on an OpenAI or OpenRouter key, and shown afterwards only as "ending in 1234". No MCP tool accepts or returns a key, so it never passes through a chat with your assistant.
An account holds one key per provider, and saving a new one replaces the old. Create a dedicated key for automations at the provider, with a spending limit where the provider offers one, so it can be revoked without breaking your other apps. If the provider ever refuses it, automations using it show Paused and you get one email; saving a key that works restarts them by themselves.
How do you verify that a Call my webhook request is genuine?
Check the signature before you read anything else. Each request carries X-EC-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">, keyed with that automation's Signing secret, which you copy from the step in the editor after saving. Recompute the HMAC over the raw bytes, compare in constant time, and refuse a t more than 5 minutes from your clock. The body also tells you two things worth acting on. dry_run is true when the request comes from Try it, so skip anything irreversible, such as creating an order. And run_id is unique to each run, so keep the ones you have handled and refuse a replayed request. Answer within 20 seconds; {"reply": "..."} is sent to the customer as written, so never pass customer text through unchecked.
POST /hooks/whatsapp HTTP/1.1
Content-Type: application/json
User-Agent: easyCoexistence-automations/1
X-EC-Event: automation.step
X-EC-Signature: t=1794405732,v1=<64 hex characters>
{
"event": "automation.step",
"dry_run": false,
"automation": { "id": "a7d0c3e2-5b1f-4c8e-9a6d-2f4e8b1c7d90", "name": "Order status" },
"run_id": "e41b9f07-3c2a-4d6e-8f15-7a9c0b2d4e68",
"channel": { "type": "whatsapp", "connection_id": "3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f", "phone": "+1 631-555-0142", "phone_number_id": "106540352242922" },
"connection": { "id": "3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f", "phone": "+1 631-555-0142", "phone_number_id": "106540352242922" },
"contact": { "id": "5511987654321", "wa_id": "5511987654321", "name": "Ana Souza" },
"message": { "id": "wamid.HBgNNTUxMTk4NzY1NDMyMRUCABIYFjNFQjBDNzE4RjQ2QjI5RDkxQTNFAA==", "type": "text", "text": "Where is my order #1042?", "at": "2026-11-11T14:02:11.000Z" },
"history": [
{ "direction": "in", "text": "Hi!", "at": "2026-11-11T14:01:40.120Z" },
{ "direction": "in", "text": "Where is my order #1042?", "at": "2026-11-11T14:02:11.310Z" }
]
}
// Your answer, within 20 seconds (or {} to send nothing):
{ "reply": "Your order #1042 left the shop at 2:20 p.m." }How do forward secrets work, and how do you rotate them?
A number set to Through easyCoexistence can forward its incoming messages to your own system. The first time you save a Forward URL, a secret is minted and shown once, under "Your signing secret, shown once. Copy it now:"; it signs each forwarded POST with the same X-EC-Signature scheme. New secret on the number's page, or set_inbound_mode with rotate_secret set to true, mints a replacement, again shown once, and from then on signs everything, retries of older deliveries included. You can also type a secret of your own, at least 24 characters, which is stored and never shown again. Stop forwarding deletes the secret, so saving a URL later starts with a fresh one.
Rotate after a teammate with access leaves, after a secret lands in a repository, a ticket or a log, and when you change hosting. A Call my webhook secret belongs to the automation and only the account owner sees it. Where the editor shows New secret, under a "Your system calls a URL" trigger, that button replaces it and the old one stops working at once; on an automation without that button, create the automation again, point your receiver at the new secret, then delete the old automation.
Which addresses can automations call?
Only public HTTPS addresses. A Call my webhook URL or a Forward URL that starts with http://, points at localhost, a private network range, a .internal or .local name, or a cloud metadata address is refused when you save it, and checked again after DNS before each request, so a public name cannot later be pointed inside a private network. Redirects are not followed: a 301 or 302 fails the step, so save the final address.
Keep secrets out of the URL itself. list_automations returns each automation's steps, webhook URL included, to any assistant connected to your account, so a token in the query string is readable there. Let the signature carry the proof instead.
How do you keep access to a minimum?
Give each person and each tool only the access its job needs, and remove what is no longer used. The connector side, with sign-in, confirmations and blocked tools, is covered on the page about connecting WhatsApp to an AI safely; on the automation side, these habits matter most:
- Ask for
get_api_credentialsonly in a private chat: the number's access token then sits in that transcript. - Prefer Call my webhook or a Forward URL over handing the token to a third-party tool.
- Delete automations you retired; that also retires their signing secrets.
- Remember that run logs hold customer messages and replies for 30 days, and Conversations keep chats for your retention period (30, 90 or 365 days), both readable in the dashboard and through your connected assistant.
- On a number set to Straight to your system, put a long random secret in the callback URL path, since Meta's signature cannot be checked there.
Common mistakes
- Verifying the signature over JSON your framework re-serialized. Many parsers change spacing, escaping or key order; compute the HMAC over the raw request bytes wherever your stack exposes them.
- Running side effects on test calls. Try it calls your webhook with dry_run set to true; an order, refund or CRM write made then is real.
- Pasting an AI key into a chat with your assistant to save time. No tool takes it, and it stays in the transcript; use AI keys in the dashboard.
- Checking a forward with the Call my webhook secret, or the reverse. They are separate secrets: one per number for forwards, one per automation for webhook calls.
Your number stays on Meta's official Cloud API through Coexistence, monitored 24/7. US$ 9 down to US$ 0.75 per number per month, falling as you add numbers, with the first 3 days free.
easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.
Frequently asked questions
Can easyCoexistence staff or support see my AI key?
The key is never displayed after you save it, not in the dashboard, not in MCP results and not in the facts the support assistant reads. It is decrypted only by the system, at the moment it calls your provider for an AI reply.
Who can read my automation run logs?
Anyone signed in to your easyCoexistence account, people you invited to it included, in the Runs tab, and any assistant connected to the account, through list_automation_runs and get_automation_run. Logs include the customer's message and the reply, and are deleted after 30 days.
How do I remove an AI key safely?
Switch Off the automations that use it first, and any agent that runs on it, then select Remove under AI keys and revoke the key at the provider. Removing it while automations still use it pauses them on their next AI reply and sends you an email.
Does Try it send customer data to my webhook?
It sends only the sample text you typed, with dry_run set to true and an empty history. Real runs send the incoming message and the chat's recent messages, up to 10, so treat your endpoint as handling customer data.
Keep reading
Ready to get started?
Set up WhatsApp Coexistence in minutes, not months. The app keeps working on the phone.
Start Free TrialVerified on