Save the message_id from the response. It is the numeric identifier you need to edit, check, or delete that message. You will also receive a message_log_id that you can use as an alternative.
Edit a Message
Edit a text message sent from ZapWhat. WhatsApp only allows editing messages during the first 15 minutes after sending; after that period the operation is rejected.
Important: use the message_id returned by POST /api/send. Do not use the internal WhatsApp ID (key.id) or the message ID on the recipient's phone.
PUThttps://zapwhat.com/api/messages
Parameter
Type
Required
Description
instance_id
String
Yes
WhatsApp session ID (also accepts the numeric ID from the panel).
message_id
String
Yes*
ID returned as message_id when the message was sent.
message_log_id
Integer
No
Alternative to message_id. Identifier returned by ZapWhat when sending.
text
String
Yes
New message content. Supports emojis and line breaks.
Yes* You must provide message_id or message_log_id.
curl --request PUT 'https://zapwhat.com/api/messages' \
--header 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"message_id": "123456789",
"text": "Hi, the event starts at 7 pm."
}'
Common errors:422 when the 15 minutes have passed or the message is not text; 404 when the message was not sent from ZapWhat or the identifier does not exist; 409 when the instance is not connected or does not have credentials ready.
Check or delete the message
The same endpoint accepts GET to check the current status and DELETE to delete it for everyone, using the same identification parameters.
The group_id is the group JID (e.g., [email protected]). You can get it with the list action.
Receive Messages (Webhooks)
To receive incoming messages, configure a Webhook URL from the Instances section of your Control Panel. Every time your number receives a message, ZapWhat sends a POST request to your server with the details.
You can configure a different webhook URL for each instance from the panel.
Received JSON Structure
{
"event": "message.incoming",
"sessionId": "TU_SESSION_ID",
"text": "Hi, I need information",
"from": "5215512345678",
"data": {
"messages": {
"key": {
"remoteJid": "[email protected]",
"fromMe": false,
"id": "MSG_ID_12345"
},
"message": {
"conversation": "Hi, I need information"
},
"messageTimestamp": 1781289344
}
}
}
PHP Implementation Example
// webhook.php - Receive ZapWhat notifications
// 1. Read the POST data
$input = file_get_contents('php://input');
$data = json_decode($input, true);
if (!$data) {
http_response_code(400);
exit('Invalid JSON');
}
// 2. Extract the main data
$messageText = $data['text'] ?? '';
$senderNumber = $data['from'] ?? '';
// 3. Process or log
if (!empty($senderNumber) && !empty($messageText)) {
$log = date('Y-m-d H:i:s') . " | Sender: $senderNumber | Message: $messageText" . PHP_EOL;
file_put_contents('webhooks.log', $log, FILE_APPEND);
}
// 4. Respond with success
http_response_code(200);
echo json_encode(['status' => 'processed']);
n8n Integration
Connect ZapWhat with n8n using the community node n8n-nodes-zapwhat, published on npm. It bundles an action node, a webhook trigger and the ZapWhat API credential.
Installation
In n8n open Settings → Community nodes → Install a community node and install n8n-nodes-zapwhat.
Restart n8n if the node does not show up in the panel.
Create the ZapWhat API credential with your Base URL and API Token (use Test to validate it).
The credential sends the token in the Authorization: Bearer … header, so it never appears in node parameters. The test request calls GET /api/instances.
Available actions
Messages (text, media, location, get, edit, delete), contacts (list, info, picture, block, sync), groups (create, metadata, participants, settings, invite link, leave), number check and instance list.
Trigger (incoming messages)
The ZapWhat Trigger node exposes a public webhook at /webhook/zapwhat. Paste that URL (or the test URL, /webhook-test/zapwhat) into Dashboard → Instance → Webhook in ZapWhat.
The webhook path is fixed, so only one workflow can listen on it. If you need several flows, branch with a Switch node on instanceId or category.
npm package: n8n-nodes-zapwhat. Its README covers installation, every action and the known limitations.
Dedicated page with the step-by-step install, three recipes (including an AI auto-reply) and ready-made workflow templates: zapwhat.com/n8n.
Three recipes to start
Recreate these flows node by node. The ZapWhat node labels are in Spanish for now; every operation maps to the API reference on this site.
1. Automatic replies with AI
Every incoming message goes through a language model and the answer is sent back to the same chat, quoting the original message.
Use the ZapWhat Trigger with the incoming event and ignore messages where fromMe is true, otherwise the workflow answers itself.
Add an AI node (OpenAI, Anthropic or the AI Agent) and paste the prompt below as the system message.
Reply with ZapWhat · Mensaje · Enviar texto: to = {{ $json.from }} and replyTo = {{ $json.messageId }}.
You are a WhatsApp support agent.
Answer in the same language the customer used, in 60 words or fewer.
Never invent prices, stock or delivery dates: when you do not know, reply
"Te paso con un asesor" and stop.
Do not use markdown, emojis or links unless the customer asks for them.
The message text leaves your server and goes to your AI provider: review your privacy policy and add a human fallback when the model is unsure. Keep answers short — WhatsApp is a chat, not email.
2. Route messages without AI
Use the WhatsApp message category or simple keywords to send each message down a different branch of the workflow.
Keywords are free, predictable and instant: use them before paying for a model call.
3. Notifications from your own system
Start the flow from your ERP, your CRM or a schedule and deliver the message to a number or a group.
Webhook / Schedule Trigger → Número · Verificar número → ZapWhat · Mensaje
Check the recipient first with Número · Verificar número and skip numbers that are not on WhatsApp.
Send text, a document (an invoice PDF, for example) or a location with the Mensaje resource.
For groups use the group JID as destination, for example [email protected].
# Your own system calls the n8n webhook
POST https://your-n8n.example.com/webhook/zapwhat-notify
{ "to": "5215512345678", "text": "Tu pedido está listo" }
The ZapWhat Trigger listens on one fixed path, so keep a single instance per workflow and route several numbers with a Switch.
Download the templates
Import the JSON files in n8n (Workflows → Import from file), type your instance ID into the ZapWhat node and select your ZapWhat API credential.
Send a text message01-enviar-texto.jsonDownload JSON
Automatic reply with a filter03-respuesta-automatica.jsonDownload JSON
Templates are plain n8n workflow exports and never include credentials or API tokens.
Best Practices
1. Anti-Spam and WhatsApp Limits
The API does not impose a strict messages-per-second limit, but your WhatsApp number is still subject to Meta's anti-spam policies. To avoid blocks:
Add random pauses (3–8 seconds) between bulk sends
Vary message content (do not use identical templates)
Avoid sending messages to users who do not have you in their contacts
Monitor block rates and adjust your speed
2. Error Handling
Implement retries with exponential backoff (wait 1s, 2s, 4s...)
Log all API errors and responses for debugging
3. Security
Never expose your API Token in client-side code
Use environment variables to store tokens
4. Built-in Proxies
ZapWhat includes a global network of rotating proxies built into all your instances automatically for maximum stability. You do not need to configure or buy additional proxies.
Automatic protection against blocks using dynamic IPs
Smart location assignment to match your region
High availability guaranteed with no extra configuration