DEV Community

HelloHop
HelloHop

Posted on

Verify signed HelloHop webhooks in n8n and auto-reply on WhatsApp

A webhook URL is public. Anyone who finds it can POST to it, so a workflow that sends WhatsApp messages in response to webhook events should check that each event really came from your provider before it does anything.

This tutorial builds an n8n workflow that:

  1. receives WhatsApp events from HelloHop,
  2. verifies the X-HelloHop-Signature header (HMAC-SHA256 of the raw body),
  3. answers 200 fast and skips events it has already handled,
  4. replies to inbound texts in direct chats.

It uses only core n8n nodes, so you do not need to enable any Node modules. I tested it on self-hosted n8n 2.49.8 with signed sample events. The Crypto credential in step 3 is a recent addition to n8n, so update first if your Crypto node does not offer one.

HelloHop is an independent WhatsApp API, not affiliated with Meta or WhatsApp.

What you need

  • An n8n instance with a public URL. HelloHop delivers only to public internet addresses, so localhost will not work.
  • A HelloHop channel with a linked number, and its channel token. The token is your API key; the console shows it once when you create it. See Quickstart.
  • A webhook secret you make up yourself: at least 24 characters. Every new receiver needs one.

The shell snippets below read these environment variables:

export HELLOHOP_API_KEY='<CHANNEL_TOKEN>'
export HELLOHOP_CHANNEL_ID='<CHANNEL_ID>'
export HELLOHOP_WEBHOOK_SECRET='<AT_LEAST_24_RANDOM_CHARACTERS>'
Enter fullscreen mode Exit fullscreen mode

One way to make a secret: openssl rand -hex 24.

How HelloHop signs a delivery

Each delivery is one POST with a JSON body and these headers:

Content-Type: application/json
X-HelloHop-Event: message
X-HelloHop-Delivery: evt_<EVENT_ID>
X-HelloHop-Signature: <64 lowercase hex characters>
Enter fullscreen mode Exit fullscreen mode

The signature is the lowercase hex HMAC-SHA256 of the raw request body, keyed with the receiver's secret, with no prefix. The word that matters is raw. If you parse the JSON and serialize it again, the bytes change and the signature no longer matches. (Webhooks docs)

An inbound text looks like this (trimmed; full list of fields in Webhook events):

{
  "id": "evt_<EVENT_ID>",
  "type": "message",
  "session": "<CHANNEL_ID>",
  "timestamp": "2026-09-17T03:00:00Z",
  "payload": {
    "id": "3EB0C767D26A1D8E2A41",
    "chat_jid": "66XXXXXXXXX@s.whatsapp.net",
    "sender_jid": "66XXXXXXXXX@s.whatsapp.net",
    "type": "text",
    "text": "hello",
    "from_me": false,
    "is_group": false,
    "timestamp": "2026-09-17T03:00:00Z"
  }
}
Enter fullscreen mode Exit fullscreen mode

The workflow

Here is the shape:

Webhook (raw body on)
  -> Set: configuration
  -> Crypto: HMAC-SHA256 of the raw body
  -> Code: compare signature, skip repeats
  -> If: signature valid?
       true  -> Respond 200 -> If: new inbound text? -> HTTP Request: send reply
       false -> Respond 401
Enter fullscreen mode Exit fullscreen mode

1. Webhook node

  • HTTP Method: POST
  • Path: hellohop-events
  • Respond: Using "Respond to Webhook" node
  • Options > Raw Body: on

Raw Body puts the exact bytes HelloHop sent into the item's binary property data. The node still parses the JSON into body for you, which the later nodes use once the signature checks out.

2. Set node: configuration

Name it Set HelloHop configuration and add two string fields:

  • channel_id: your channel ID
  • api_base: https://api.hellohop.app/v1

Turn on Include Other Input Fields, and in Options make sure Strip Binary Data is off. If the Set node drops the binary, the Crypto node has nothing to hash. That one cost me a test run.

3. Crypto node: compute the HMAC

Name it Compute HMAC-SHA256 of raw body.

  • Action: Hmac
  • Binary File: on, Binary Property Name: data
  • Type: SHA256
  • Encoding: hex
  • Property Name: expected_signature
  • Credential: create a Crypto credential and paste your webhook secret into Hmac Secret.

The secret lives in a credential, so it never appears in the workflow JSON when you export or share it.

4. Code node: compare and skip repeats

Name the Webhook node Receive HelloHop webhook (the code refers to it by name), then add a Code node with this:

// Compares X-HelloHop-Signature with the HMAC computed by "Compute HMAC-SHA256 of raw body".
// Plain JavaScript on purpose, so the workflow runs without enabling any Node modules:
// it checks the length first, then XORs EVERY character with no early exit. That removes
// the early-exit timing leak of ===; it is not a guaranteed constant-time compare.
// If your n8n lets the Code node use the crypto module, crypto.timingSafeEqual is the
// stronger choice (keep the length check, because it throws on unequal lengths).
const expected = String($json.expected_signature || '');
const headers = $('Receive HelloHop webhook').first().json.headers || {};
const given = String(headers['x-hellohop-signature'] || '');

let valid = expected.length === 64 && given.length === expected.length;
if (valid) {
  let diff = 0;
  for (let i = 0; i < expected.length; i++) {
    diff |= expected.charCodeAt(i) ^ given.charCodeAt(i);
  }
  valid = diff === 0;
}

// The body was signed as raw bytes; the Webhook node also parsed it into json.body.
const event = valid ? $('Receive HelloHop webhook').first().json.body : null;

// Skip repeats: HelloHop delivers at least once and a retry keeps the same body id.
// Static data persists only for published (production) executions.
let duplicate = false;
if (valid && event && event.id) {
  const store = $getWorkflowStaticData('global');
  store.seen = store.seen || [];
  duplicate = store.seen.includes(event.id);
  if (!duplicate) {
    store.seen.push(event.id);
    if (store.seen.length > 500) store.seen = store.seen.slice(-500);
  }
}

return [{ json: { valid, duplicate, event } }];
Enter fullscreen mode Exit fullscreen mode

Two notes on this code:

  • Deduplicate on the body id, after verifying. A retry keeps the same id. The X-HelloHop-Delivery header carries the same value, but headers are not signed, so trust the id inside the verified body.
  • 500 ids in static data is a starter. For production, keep processed ids in a database.

5. If node and the two responses

Signature valid? checks {{ $json.valid }} is true.

  • True branch: a Respond to Webhook node answering 200 with { "ok": true }.
  • False branch: a Respond to Webhook node answering 401 with { "error": "invalid signature" }.

Answer before you do any slow work. HelloHop's delivery timeout is 10 seconds by default, and anything other than a 2xx in time counts as a failure and gets retried. Duplicates and events you do not act on still get 200, so they stop retrying.

6. Only reply to new inbound texts

Connect a second If node, Is new inbound text?, after the 200 response. All five conditions must hold:

Value Check
{{ $json.duplicate }} is false
{{ $json.event.type }} equals message
{{ $json.event.payload.type }} equals text
{{ $json.event.payload.from_me }} is false
{{ $json.event.payload.is_group }} is false

The from_me check matters: messages you send from the paired phone also arrive as message events, and without the check each one would trigger the canned reply in that chat. Drop the is_group condition if you want replies in groups too.

7. Send the reply

An HTTP Request node named Send WhatsApp reply:

  • Method: POST
  • URL: {{ $('Set HelloHop configuration').first().json.api_base }}/sessions/{{ encodeURIComponent($('Set HelloHop configuration').first().json.channel_id) }}/messages/text
  • Authentication: Generic Credential Type > Header Auth. Create the credential with Name Authorization and Value Bearer <CHANNEL_TOKEN>.
  • Send Body: JSON, using this expression:
{{ JSON.stringify({ to: $json.event.payload.chat_jid, text: 'Thanks for your message. We will get back to you soon.' }) }}
Enter fullscreen mode Exit fullscreen mode

to takes a phone number in international form or a JID, so the incoming chat_jid works as is. A send that goes out right away answers 200 with id, chat_jid, timestamp and status: "server_ack", which means WhatsApp's servers took the message. If the channel holds sends in a queue (for example, outside reply hours you have set), the answer is 202 with status: "queued" and a position instead. Delivery and read receipts arrive later as message.status events, if you list that type in events.

Each text gets one reply at most: the event was already answered with 200 and marked as handled, so if the send fails it is not retried. For a starter auto-reply that is the safer direction.

Test the signature check locally first

Before you point HelloHop at the workflow, check that it accepts a correctly signed body and rejects a tampered one. Deactivate the Send WhatsApp reply node so nothing goes out, publish the workflow, and copy its production URL. The two checks below were run against the production URL.

export N8N_WEBHOOK_URL='https://<your-n8n-host>/webhook/hellohop-events'

cat > event.json <<'JSON'
{"id":"evt_local_test_1","type":"message","session":"my-channel","timestamp":"2026-09-17T03:00:00Z","payload":{"id":"3EB0C767D26A1D8E2A41","chat_jid":"66XXXXXXXXX@s.whatsapp.net","sender_jid":"66XXXXXXXXX@s.whatsapp.net","type":"text","text":"hello","from_me":false,"is_group":false,"timestamp":"2026-09-17T03:00:00Z"}}
JSON

SIG=$(openssl dgst -sha256 -hmac "$HELLOHOP_WEBHOOK_SECRET" -hex < event.json | awk '{print $NF}')

# Correct signature: expect 200
curl -s -o /dev/null -w '%{http_code}\n' -X POST "$N8N_WEBHOOK_URL" \
  -H 'Content-Type: application/json' -H "X-HelloHop-Signature: $SIG" \
  --data-binary @event.json

# One character changed, same signature: expect 401
sed 's/"hello"/"hellO"/' event.json > tampered.json
curl -s -o /dev/null -w '%{http_code}\n' -X POST "$N8N_WEBHOOK_URL" \
  -H 'Content-Type: application/json' -H "X-HelloHop-Signature: $SIG" \
  --data-binary @tampered.json
Enter fullscreen mode Exit fullscreen mode

Use --data-binary, not -d. Plain -d strips newlines from a file, so the bytes you send would differ from the bytes you signed.

Register the workflow with HelloHop

The workflow is already published, so set its production URL as a receiver:

curl -X PUT "https://api.hellohop.app/v1/sessions/$HELLOHOP_CHANNEL_ID/webhooks" \
  -H "Authorization: Bearer $HELLOHOP_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"receivers\": [{\"url\": \"$N8N_WEBHOOK_URL\", \"events\": [\"message\"], \"secret\": \"$HELLOHOP_WEBHOOK_SECRET\"}]}"
Enter fullscreen mode Exit fullscreen mode

PUT replaces the whole receiver list, so include any receivers you already use. List the event types you want in events. The answer echoes each receiver with secret_set: true and never repeats the secret.

Now fire a signed test event at it:

curl -X POST "https://api.hellohop.app/v1/sessions/$HELLOHOP_CHANNEL_ID/webhooks/test" \
  -H "Authorization: Bearer $HELLOHOP_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"url\": \"$N8N_WEBHOOK_URL\"}"
Enter fullscreen mode Exit fullscreen mode
{
  "status": "delivered",
  "detail": "the receiver accepted a signed test event; nothing was sent to WhatsApp"
}
Enter fullscreen mode Exit fullscreen mode

The test event has type webhook.test, so it passes the signature check and then stops at Is new inbound text?. If you do not get delivered, open the execution in n8n: a 401 there usually means the Crypto credential holds a different secret from the one you sent in PUT webhooks.

Turn Send WhatsApp reply back on and make sure the published version of the workflow includes that change. Then send your number a WhatsApp message from another phone. The reply should come back.

Common mistakes

  • Hashing parsed JSON. Hash the raw bytes instead. The Webhook node's Raw Body option is what makes this possible in n8n.
  • Losing the binary on the way. Any node between the Webhook and the Crypto node must pass binary data through.
  • Comparing with ===. It stops at the first differing character. Use a compare that walks the whole string.
  • Mixing up secrets. Each receiver has its own secret. Use the one for the URL this workflow listens on.
  • Answering slowly. Answer first, then do the work.

Further reading

  • Webhooks: delivery, signing, retries and duplicates
  • Webhook events: every event type and payload
  • Errors: what each error code means and when to retry

Top comments (0)