Send WhatsApp Messages After AI Agents Call
Written By Product
Last updated 9 months ago
Workflow overview
[Webhook DeepAgent] → [IF: Condizione] → [WhatsApp: Invia Messaggio]This workflow allows you to automatically send a WhatsApp message to the contact at the end of a call handled by DeepAgent.
Step 1: Prepare the Workflow
Log in to n8n
Open the DeepAgent Post-Call Webhook workflow
The Webhook node is already configured
You will add the following nodes starting from this one
Step 2: Add a Filter (Recommended)
The filter is used to send WhatsApp messages only for certain calls.
Click + after the Webhook node
Add the IF node
Configure a basic condition:
Useful alternative conditions: - {{ $json.sentimentLabel }} = positive - {{ $json.success }} = success
Step 3: Choose the WhatsApp Provider
n8n supports several providers:
Step 4A: WhatsApp Business Cloud API (Recommended)
Requirements
Verified Meta Business account
Meta app with WhatsApp API enabled
Access Token
Phone Number ID
Node configuration
Message example
Hello {{ $json.payload.metadata.dynamicVariables.user_name }},
thank you for calling our assistant.
Summary: {{ $json.callSummary }}
For any information, you can reply to this message.
Step 4B: Twilio (Alternative)
Prerequisites
Twilio account
Active WhatsApp Sender
Node configuration
Step 5: Format the Phone Number
To avoid errors, it is recommended to format the number before sending.
Add a Code node (JavaScript) between IF and WhatsApp:
let phone = $json.phoneNumber || '';
phone = phone.replace(/[\s\-\(\)\.]/g,
'');
if (!phone.startsWith('+')) {
if (phone.startsWith('00')) phone = '+' + phone.substring(2);
else if (phone.startsWith('3')) phone = '+39' + phone;
else phone = '+' + phone;
}
return { ...$json, formattedPhone: phone };In the WhatsApp node, use:
{{ $json.formattedPhone }}Step 6: Complete Workflow
[Webhook]
↓
[IF] status = completed
↓ (true)
[Code] format phone
↓
[WhatsApp] send messageStep 7: Test the Flow
Activate the workflow (toggle ON)
Make a test call with DeepAgent
Check the Executions section in n8n
Verify that the WhatsApp message is received
Available Variables
Example Complete Message
Dear {{ $json.payload.metadata.dynamicVariables.user_name }},
Thank you for speaking with our virtual assistant.
📞 Call duration: {{ Math.round($json.callDuration / 60) }} minutes 📝 Summary:
{{ $json.callSummary }}
If you would like more information, you can reply to this message.
Best regards
Troubleshooting
Was this helpful?
More in Integrations
How to integrate your AI agents DeepAgent with n8nStill need help? Share an idea