{
  "name": "WhatsApp auto-reply with Hypersender",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "hypersender-whatsapp",
        "authentication": "headerAuth",
        "options": {}
      },
      "name": "Hypersender webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "5d2f4c1e-8a3b-4f7e-9c21-0b6a1f3e9d47"
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "loose", "version": 2 },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.body.event }}",
              "rightValue": "message.any",
              "operator": { "type": "string", "operation": "equals" }
            },
            {
              "id": "c2",
              "leftValue": "={{ $json.body.data.payload.fromMe }}",
              "rightValue": "",
              "operator": { "type": "boolean", "operation": "false", "singleValue": true }
            },
            {
              "id": "c3",
              "leftValue": "={{ $json.body.data.payload.from }}",
              "rightValue": "@c.us",
              "operator": { "type": "string", "operation": "endsWith" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "name": "New message from a person?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://app.hypersender.com/api/whatsapp/v2/YOUR_INSTANCE_ID/send-text",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ chatId: $json.body.data.payload.from, text: 'Thanks for your message. We usually reply within an hour.' }) }}",
        "options": {}
      },
      "name": "Send WhatsApp reply",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, -100]
    }
  ],
  "connections": {
    "Hypersender webhook": { "main": [[{ "node": "New message from a person?", "type": "main", "index": 0 }]] },
    "New message from a person?": { "main": [[{ "node": "Send WhatsApp reply", "type": "main", "index": 0 }], []] }
  },
  "settings": { "executionOrder": "v1" }
}
