WhatsApp away message outside working hours
Customers who message after hours get a polite Arabic and English reply with your opening times.
How it works
Trigger: WhatsApp — new incoming message
- Receive the message.
- Check the time in your timezone against your working days and hours.
- If you're closed, send the away message.
Diagram
Trigger App Logic Code
Code
JavaScript used in the Code step — already included in the template below.
// Decides whether a WhatsApp message arrived outside working hours.
// Set your timezone, working days (0 = Sunday) and hours.
const TIMEZONE = "Africa/Cairo";
const WORK_DAYS = [0, 1, 2, 3, 4];
const OPEN = 9;
const CLOSE = 18;
const msg = $input.first().json.messages?.[0];
if (!msg) return [];
const local = new Date(new Date(Number(msg.timestamp) * 1000).toLocaleString("en-US", { timeZone: TIMEZONE }));
const open = WORK_DAYS.includes(local.getDay()) && local.getHours() >= OPEN && local.getHours() < CLOSE;
return [{ json: { from: msg.from, afterHours: !open } }];Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.
Show code (141 lines)
{
"name": "WhatsApp away message outside working hours (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## WhatsApp away message outside working hours\nCustomers who message after hours get a polite Arabic and English reply with your opening times.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"updates": [
"messages"
]
},
"id": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1",
"name": "Incoming message",
"type": "n8n-nodes-base.whatsAppTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"webhookId": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1"
},
{
"parameters": {
"jsCode": "// Decides whether a WhatsApp message arrived outside working hours.\n// Set your timezone, working days (0 = Sunday) and hours.\nconst TIMEZONE = \"Africa/Cairo\";\nconst WORK_DAYS = [0, 1, 2, 3, 4];\nconst OPEN = 9;\nconst CLOSE = 18;\n\nconst msg = $input.first().json.messages?.[0];\nif (!msg) return [];\n\nconst local = new Date(new Date(Number(msg.timestamp) * 1000).toLocaleString(\"en-US\", { timeZone: TIMEZONE }));\nconst open = WORK_DAYS.includes(local.getDay()) && local.getHours() >= OPEN && local.getHours() < CLOSE;\n\nreturn [{ json: { from: msg.from, afterHours: !open } }];"
},
"id": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1",
"name": "Outside working hours?",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "c1",
"leftValue": "={{ $json.afterHours }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1",
"name": "After hours?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
600,
0
]
},
{
"parameters": {
"operation": "send",
"phoneNumberId": "YOUR_PHONE_NUMBER_ID",
"recipientPhoneNumber": "={{ $json.from }}",
"textBody": "شكرًا لتواصلك معنا 🙏 نحن خارج ساعات العمل الآن (الأحد–الخميس، 9 ص – 6 م). سنرد عليك أول ما نفتح.\n\nThanks for your message! We're closed right now and will reply first thing when we open."
},
"id": "3f36c28d-dcaa-4fe7-afb0-dde2cffcb7d1",
"name": "Send away message",
"type": "n8n-nodes-base.whatsApp",
"typeVersion": 1,
"position": [
900,
0
]
}
],
"connections": {
"Incoming message": {
"main": [
[
{
"node": "Outside working hours?",
"type": "main",
"index": 0
}
]
]
},
"Outside working hours?": {
"main": [
[
{
"node": "After hours?",
"type": "main",
"index": 0
}
]
]
},
"After hours?": {
"main": [
[
{
"node": "Send away message",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- WhatsApp Business Cloud › Watch Events (messages)
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Filter on the next route: “After hours?”
- If yesWhatsApp Business Cloud › Send a Message
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- WhatsApp — New Message
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Filter by Zapier: “After hours?”
- If yesWhatsApp — Send Message
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Set your timezone, days and hours at the top of the Code step.
Related flows
Customer SupportAdvanced
WhatsApp FAQ assistant
Answer common customer questions on WhatsApp 24/7 using your own FAQ.
WhatsApp → AI model15h/mo
Customer SupportMedium
WhatsApp reminders for tomorrow's appointments
Clients get a WhatsApp reminder the day before their appointment — fewer no-shows.
Google Calendar → WhatsApp8h/mo
Customer SupportEasy
Ask for a rating on WhatsApp after a ticket is closed
When a support ticket is closed, the customer gets a WhatsApp message asking them to rate the help.
Webhook → WhatsApp2h/mo