{"connections":{"Signature valid?":{"main":[[{"index":0,"node":"Event — your logic here","type":"main"}],[{"index":0,"node":"Invalid signature — dropped","type":"main"}]]},"Verify signature":{"main":[[{"index":0,"node":"Signature valid?","type":"main"}]]},"Webhook — DomainGuard events":{"main":[[{"index":0,"node":"Verify signature","type":"main"}]]}},"name":"DomainGuard — event receiver (Ingenious AI integrations)","nodes":[{"id":"d6ce001-0001-4000-8000-000000000001","name":"Webhook — DomainGuard events","notes":"1) Import this workflow, then activate it (toggle top-right) and copy the PRODUCTION URL of this Webhook node. 2) In DomainGuard open your claimed report's Integrations page (/report/job/<your report token>/integrations) and create a subscription: channel 'Webhook (n8n / generic)', target = that production URL. The signing secret is shown once at creation — paste it into the 'Verify signature' node next door. Delivery is at-least-once: dedupe on event_id in your own logic.","parameters":{"httpMethod":"POST","options":{},"path":"domainguard-events"},"position":[240,320],"type":"n8n-nodes-base.webhook","typeVersion":2,"webhookId":"d6ce001-0001-4000-8000-0000000000ff"},{"id":"d6ce001-0002-4000-8000-000000000002","name":"Verify signature","notes":"Paste your subscription secret into the SECRET constant. If your n8n restricts Node builtins in Code nodes, allow 'crypto' (NODE_FUNCTION_ALLOW_BUILTIN=crypto) on your n8n host — it is your instance, so this is your call.","parameters":{"jsCode":"// Verify the X-Ingenious-Signature header: HMAC-SHA256 over the\n// canonical envelope (the event body without `data`, keys sorted,\n// compact JSON) — the same function the product documents at\n// /integrations. Replace the secret below with the one shown once\n// when you created the subscription.\nconst crypto = require('crypto');\nconst SECRET = 'PASTE_YOUR_SUBSCRIPTION_SECRET';\n\nfunction canonicalize(value) {\n  if (value === null || typeof value !== 'object') {\n    return JSON.stringify(value);\n  }\n  if (Array.isArray(value)) {\n    return '[' + value.map(canonicalize).join(',') + ']';\n  }\n  const keys = Object.keys(value).sort();\n  return '{' + keys.map(function (k) {\n    return JSON.stringify(k) + ':' + canonicalize(value[k]);\n  }).join(',') + '}';\n}\n\nconst item = $input.first();\nconst headers = (item.json && item.json.headers) || {};\nconst body = (item.json && item.json.body) || {};\nconst envelope = Object.assign({}, body);\ndelete envelope.data;\nconst expected = crypto.createHmac('sha256', SECRET)\n  .update(canonicalize(envelope), 'utf8').digest('hex');\nconst provided = String(headers['x-ingenious-signature'] || '')\n  .replace('sha256=', '');\nlet valid = false;\ntry {\n  valid = provided.length === expected.length &&\n    crypto.timingSafeEqual(Buffer.from(provided), Buffer.from(expected));\n} catch (e) { valid = false; }\nreturn [{ json: Object.assign({}, body, { signature_valid: valid }) }];\n","mode":"runOnceForAllItems"},"position":[480,320],"type":"n8n-nodes-base.code","typeVersion":2},{"id":"d6ce001-0003-4000-8000-000000000003","name":"Signature valid?","parameters":{"conditions":{"combinator":"and","conditions":[{"id":"d6ce001-0003-4000-8000-0000000000c1","leftValue":"={{ $json.signature_valid }}","operator":{"operation":"true","singleValue":true,"type":"boolean"},"rightValue":true}],"options":{"caseSensitive":true,"leftValue":"","typeValidation":"loose"}},"options":{}},"position":[720,320],"type":"n8n-nodes-base.if","typeVersion":2.2},{"id":"d6ce001-0004-4000-8000-000000000004","name":"Event — your logic here","notes":"Verified DomainGuard event. Replace this node with your own logic: open a ticket, message your team, call the API back (GET /api/v1/actions lists what still needs a decision).","parameters":{"assignments":{"assignments":[{"id":"d6ce001-0004-4000-8000-0000000000a1","name":"event_type","type":"string","value":"={{ $json.event_type }}"},{"id":"d6ce001-0004-4000-8000-0000000000a2","name":"entity_id","type":"string","value":"={{ $json.entity_id }}"},{"id":"d6ce001-0004-4000-8000-0000000000a3","name":"action_summary","type":"string","value":"={{ $json.action_summary }}"},{"id":"d6ce001-0004-4000-8000-0000000000a4","name":"occurred_at","type":"string","value":"={{ $json.occurred_at }}"}]},"options":{}},"position":[960,240],"type":"n8n-nodes-base.set","typeVersion":3.4},{"id":"d6ce001-0005-4000-8000-000000000005","name":"Invalid signature — dropped","notes":"The signature did not verify, so the event was dropped. Check that the SECRET in 'Verify signature' matches the subscription secret in DomainGuard.","parameters":{},"position":[960,440],"type":"n8n-nodes-base.noOp","typeVersion":1}],"pinData":{},"settings":{"executionOrder":"v1"}}