{
  "name": "WABridges: reply to WhatsApp messages",
  "nodes": [
    {
      "parameters": {
        "content": "## Reply to WhatsApp messages with WABridges\n\nTwo-way skeleton: every incoming WhatsApp message starts this workflow, and one HTTP request sends the answer. Swap the reply node for your own logic (CRM lookup, order status, human handoff).\n\n**How it works**\n\n**WhatsApp message received** (Webhook, verified with your webhook secret) → **Settings** → **New message from someone else?** (skips your own outgoing messages and non-message events) → **Send reply**.\n\n**Setup**\n\n1. Create a WABridges account (free trial, no card): https://wabridges.com\n2. Dashboard → API key → create one. In n8n add a **Header Auth** credential named `WABridges API key`: name `Authorization`, value `Bearer sk_...`\n3. On the dashboard find the bridge's *Webhook secret* (the sandbox has one too). In n8n add a second **Header Auth** credential named `WABridges webhook secret`: name `Authorization`, value `Bearer whsec_...`. Select it in **WhatsApp message received**.\n4. Select the API key credential in **Send reply**.\n5. Activate the workflow, copy the Webhook node's **Production URL** and paste it into the bridge's *Webhook URL* field on the dashboard.\n6. Test with the sandbox: send yourself a message with the *Send a WhatsApp message* workflow. Alice answers, this workflow answers her, and after a few rounds the sandbox pauses the loop on purpose.\n7. Going live: set `customer_ref` to your real bridge, swap the webhook secret credential to that bridge's secret, paste the Production URL on that bridge's page.\n\nGuide with screenshots-free, field-by-field instructions: https://wabridges.com/guides/whatsapp-n8n",
        "width": 640,
        "height": 720,
        "color": 4
      },
      "id": "b0e9c1a7-8a17-5148-9dab-fb453040763b",
      "name": "About this workflow",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1000,
        -420
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "wabridges",
        "authentication": "headerAuth",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "c6926736-2cca-5503-9689-ea73a42bfa41",
      "name": "WhatsApp message received",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -200,
        0
      ],
      "webhookId": "8ea3a7ac-24aa-5925-948e-bcf2b0169e36",
      "credentials": {
        "httpHeaderAuth": {
          "id": "wabridges-webhook-secret",
          "name": "WABridges webhook secret"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c3383a47-dace-5e2e-96fe-e2a0997acdeb",
              "name": "customer_ref",
              "value": "sandbox",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "afa14d2d-2b71-550c-9685-dbe31ffd1f6c",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        40,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "67e4ab2c-60fd-5bf8-90f0-74f51d0c7ed2",
              "leftValue": "={{ $json.body.event }}",
              "rightValue": "message",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "c7dd7430-a6fd-5bbb-842a-b4f3d2b7d0a5",
              "leftValue": "={{ $json.body.from_me }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7b8e1c0a-66a2-5e63-9247-3c27462c4e7b",
      "name": "New message from someone else?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        280,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://wabridges.com/api/instances/{{ $('Settings').item.json.customer_ref }}/proxy/send/text",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ chat: $json.body.chat_id, body: 'Got it 👍 You said: \"' + $json.body.body + '\". (Replace this node with your own logic.)' }) }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $execution.id }}-{{ $json.body.message_id }}"
            }
          ]
        }
      },
      "id": "e0b3ad21-1c1b-5eb9-9d96-1f1cae7c4c5b",
      "name": "Send reply",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        -60
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "wabridges-api-key",
          "name": "WABridges API key"
        }
      },
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000,
      "notesInFlow": true,
      "notes": "POST /api/instances/{customer_ref}/proxy/send/text"
    },
    {
      "parameters": {
        "content": "### What the Webhook node receives\n\nEvent fields live under `$json.body`:\n\n- `event` — `message`, `connected`, `disconnected`, `call_incoming`, ...\n- `body` — message text (empty for media; see `caption`, `media_type`)\n- `chat_id` — where to reply (`...@s.whatsapp.net` or `...@g.us`)\n- `phone`, `name` — the sender\n- `from_me` — `true` for messages sent from your own phone\n- `is_group`, `message_id`, `timestamp`\n\nFull list: https://wabridges.com/docs/webhooks",
        "width": 420,
        "height": 380
      },
      "id": "13775185-6a7c-5a6b-88f3-b493268286c9",
      "name": "Incoming event fields",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -260,
        -420
      ]
    },
    {
      "parameters": {
        "content": "### Safe retries\n\n**Send reply** sends an `Idempotency-Key` built from the execution and message id, so n8n retries never double-send. WABridges replays the stored response instead.",
        "width": 320,
        "height": 210
      },
      "id": "8d0ce62c-12bd-54e3-b2ad-ffa0a36b1a00",
      "name": "Idempotency",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        520,
        -320
      ]
    }
  ],
  "connections": {
    "WhatsApp message received": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "New message from someone else?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New message from someone else?": {
      "main": [
        [
          {
            "node": "Send reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "active": false
}