WhatsApp away message outside working hours

Customers who message after hours get a polite Arabic and English reply with your opening times.

Easy Saves ~2 hours/month Customer SupportBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: WhatsApp — new incoming message
  1. Receive the message.
  2. Check the time in your timezone against your working days and hours.
  3. If you're closed, send the away message.

Diagram

trueWIncoming messageWhatsApp Trigger{ }Outside working hou…Code⑂After hours?IfWSend away messageWhatsApp Business Cloud
Trigger App Logic Code

Code

JavaScript used in the Code step — already included in the template below.

Outside working hours? · Code node
// 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.

Workflow JSON
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": []
}

Open in the playground to edit →

Tips

  • Set your timezone, days and hours at the top of the Code step.

Related flows