{ "name": "insta-webhook-new", "nodes": [ { "parameters": { "multipleMethods": true, "httpMethod": [ "POST", "GET" ], "path": "pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc", "responseMode": "responseNode", "options": { "rawBody": true } }, "type": "n8n-nodes-base.webhook", "typeVersion": 2.1, "position": [ -928, 208 ], "id": "83c49ffb-88f3-4e60-9127-16a9a2b3dade", "name": "Insta-Webhook", "webhookId": "fc68db76-1651-4716-8170-dcda36aa4a5d" }, { "parameters": { "action": "hmac", "binaryData": true, "type": "SHA256", "dataPropertyName": "computed-sha256", "secret": "af19006e69ba95eb398f68a614a5c861" }, "type": "n8n-nodes-base.crypto", "typeVersion": 1, "position": [ -640, 128 ], "id": "e09068d3-4397-4391-8854-20348c5a9007", "name": "x-hash-create", "alwaysOutputData": false }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "376cee8d-570b-4f25-bd45-c349a23061ae", "leftValue": "={{ $json.headers['x-hub-signature-256'] }}", "rightValue": "={{ 'sha256=' + $json['computed-sha256'] }}", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "looseTypeValidation": "={{ false }}", "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.3, "position": [ -480, 32 ], "id": "cb9f2f49-dffa-4703-bee0-36404e1c622c", "name": "xhash-check" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "abf63ae7-71ab-4b33-a3b5-d04b018b158a", "leftValue": "={{ $json.query['hub.mode'] }}", "rightValue": "subscribe", "operator": { "type": "string", "operation": "equals" } }, { "id": "89c602d5-d7b3-4cae-8bc1-9aa02ab2e0a7", "leftValue": "={{ $json.query['hub.verify_token'] }}", "rightValue": "kCSL6gd75nf8JQ6HH9c8#QfeYE!Ee!zH8Ci$", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.3, "position": [ -720, 320 ], "id": "a1cdb5e0-631f-42a8-831c-fe51e574fe52", "name": "Subscribe check" }, { "parameters": { "respondWith": "text", "responseBody": "={{ $json.query['hub.challenge'] }}", "options": { "responseCode": 200 } }, "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.5, "position": [ -496, 208 ], "id": "4a17f7d8-3764-4f61-9ef3-c29f2eecdb0f", "name": "subscribe respond" }, { "parameters": { "respondWith": "text", "responseBody": "return false", "options": { "responseCode": 400 } }, "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.5, "position": [ -496, 384 ], "id": "35564549-82a2-4374-9d4f-97d2565516f4", "name": "subscribe error" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "d494455e-0ca8-430e-9d76-496d5d5762e5", "leftValue": "={{ $json.body.entry[0].changes[0].value.from.username }}", "rightValue": "plantbasedsoutherner", "operator": { "type": "string", "operation": "equals", "name": "filter.operator.equals" } }, { "id": "8aba4377-943a-4f4d-a74f-8d0411c30b24", "leftValue": "={{ $json.body.entry[0].changes[0].value.from.id }}", "rightValue": "178414703386961181", "operator": { "type": "string", "operation": "equals", "name": "filter.operator.equals" } } ], "combinator": "or" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.3, "position": [ 192, -80 ], "id": "9e2e6790-95f4-4d7d-913b-749a01f2c890", "name": "Check if we sent" }, { "parameters": { "method": "POST", "url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"title\": \"Subscribe Message ⚠️\",\n \"message\": \"Failed to subscribed to FB webook. Check FB workflow.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 224, 448 ], "id": "949aa0db-3592-4bcf-82e7-6cafa8de4759", "name": "subscribe to FB error" }, { "parameters": { "mode": "raw", "jsonOutput": "={\n \"webhook_payload\": {{ $('Insta-Webhook').first().json }}\n} ", "includeOtherFields": "={{ false }}", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 416, -80 ], "id": "217a3ba7-da03-42cb-ad0c-70bba8237498", "name": "Edit Fields" }, { "parameters": { "method": "POST", "url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"title\": \"Subscribe Message 🏁\",\n \"message\": \"Successfully subscribed to FB webook. No error message here.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 224, 272 ], "id": "cea660ef-fc75-4ed9-90b4-2c02e005029d", "name": "subscribe to FB success" }, { "parameters": { "method": "POST", "url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"title\": \"⛔ Hash Verification FAILED\",\n \"message\": \"Incoming webhook failed signature check. Possible spoofed or malicious request. Check n8n logs immediately.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}", "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 224, 96 ], "id": "f691fdf0-f1af-4b87-9c64-942c500035e6", "name": "xhash error" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "12b4e16f-03b5-46c5-a2a6-59c06a584bae", "leftValue": "={{ $json.body.entry[0].messaging?.[0]?.message?.is_echo === true }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.3, "position": [ -288, -112 ], "id": "784bd9c7-7066-4fd0-9653-3a54ca7c2ea4", "name": "Check_Echo" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "cbf36acb-c894-4aeb-9c48-cedfce0b75f9", "leftValue": "={{ $json.body.entry[0].messaging?.[0]?.read !== undefined }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.3, "position": [ -64, -96 ], "id": "949f370d-7ecb-4484-a002-851e8942461a", "name": "Check_Read" }, { "parameters": { "mode": "raw", "jsonOutput": "={\n \"title\": \"Subscribe Message 🏁\",\n \"message\": \"Successfully subscribed to FB webook. No error message here.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -288, 208 ], "id": "31f3cfaa-a335-4a13-ae83-600676a6d218", "name": "set_sub_FB_success" }, { "parameters": { "mode": "raw", "jsonOutput": "={\n \"title\": \"Subscribe Message ⚠️\",\n \"message\": \"Failed to subscribed to FB webook. Check FB workflow.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -304, 400 ], "id": "104205c9-3fbc-4685-98ea-a53b5dbfbdeb", "name": "set_sub_FB_error" }, { "parameters": { "mode": "raw", "jsonOutput": "={\n \"title\": \"⛔ Hash Verification FAILED\",\n \"message\": \"Incoming webhook failed signature check. Possible spoofed or malicious request. Check n8n logs immediately.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -272, 48 ], "id": "3f7d7b11-b9db-4c15-a3a1-234bfd6d7b76", "name": "set_xhash_error" }, { "parameters": { "workflowId": { "__rl": true, "value": "P465jEMJyKNZGOHVppbv2", "mode": "list", "cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2", "cachedResultName": "SendPBSChat_New" }, "workflowInputs": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.3, "position": [ -32, 208 ], "id": "edc9675f-f48b-4add-99a9-6cccb3738413", "name": "Call 'SendPBSChat_New'" }, { "parameters": { "workflowId": { "__rl": true, "value": "gtosD7EYCQQ8JoqOaLtUA", "mode": "list", "cachedResultUrl": "/workflow/gtosD7EYCQQ8JoqOaLtUA", "cachedResultName": "Sub-instra-reply-handle-new" }, "workflowInputs": { "mappingMode": "defineBelow", "value": {}, "matchingColumns": [], "schema": [], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.3, "position": [ 592, -80 ], "id": "eeef03ce-52f6-4989-8820-c53649adc6cf", "name": "Call 'Sub-instra-reply-handle-new'" } ], "pinData": { "subscribe error": [ { "json": { "name": "First item", "code": 1 } }, { "json": { "name": "Second item", "code": 2 } } ], "Insta-Webhook": [ { "json": { "headers": { "host": "n8n.plantbasedsoutherner.com", "user-agent": "Webhooks/1.0 (https://fb.me/webhooks)", "content-length": "301", "accept": "*/*", "content-type": "application/json", "origin": "https://n8n.plantbasedsoutherner.com", "x-forwarded-for": "173.252.95.114", "x-forwarded-host": "n8n.plantbasedsoutherner.com", "x-forwarded-port": "443", "x-forwarded-proto": "https", "x-forwarded-server": "874112b5743e", "x-hub-signature": "sha1=eca2b4e1b17b6fe27c338c49e7f7fa58943f2d5c", "x-hub-signature-256": "sha256=f428f52a183d49ce5df8773907b1da186c45d9c8d5e43b207fb434f0e978c95f", "x-real-ip": "173.252.95.114", "accept-encoding": "gzip" }, "params": {}, "query": {}, "body": { "entry": [ { "id": "17841470338696118", "time": 1775170323, "changes": [ { "value": { "from": { "id": "2132711740817216", "username": "tjherby" }, "media": { "id": "18318289864268976", "media_product_type": "REELS" }, "id": "17913212886344579", "text": "bowl" }, "field": "comments" } ] } ], "object": "instagram" }, "webhookUrl": "https://n8n.plantbasedsoutherner.com/webhook/pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc", "executionMode": "production" }, "binary": { "data": { "data": "eyJlbnRyeSI6IFt7ImlkIjogIjE3ODQxNDcwMzM4Njk2MTE4IiwgInRpbWUiOiAxNzc1MTcwMzIzLCAiY2hhbmdlcyI6IFt7InZhbHVlIjogeyJmcm9tIjogeyJpZCI6ICIyMTMyNzExNzQwODE3MjE2IiwgInVzZXJuYW1lIjogInRqaGVyYnkifSwgIm1lZGlhIjogeyJpZCI6ICIxODMxODI4OTg2NDI2ODk3NiIsICJtZWRpYV9wcm9kdWN0X3R5cGUiOiAiUkVFTFMifSwgImlkIjogIjE3OTEzMjEyODg2MzQ0NTc5IiwgInRleHQiOiAiYm93bCJ9LCAiZmllbGQiOiAiY29tbWVudHMifV19XSwgIm9iamVjdCI6ICJpbnN0YWdyYW0ifQ==", "mimeType": "application/json" } }, "pairedItem": { "item": 0 } } ] }, "connections": { "Insta-Webhook": { "main": [ [ { "node": "x-hash-create", "type": "main", "index": 0 } ], [ { "node": "Subscribe check", "type": "main", "index": 0 } ] ] }, "x-hash-create": { "main": [ [ { "node": "xhash-check", "type": "main", "index": 0 } ] ] }, "xhash-check": { "main": [ [ { "node": "Check_Echo", "type": "main", "index": 0 } ], [ { "node": "set_xhash_error", "type": "main", "index": 0 } ] ] }, "Subscribe check": { "main": [ [ { "node": "subscribe respond", "type": "main", "index": 0 } ], [ { "node": "subscribe error", "type": "main", "index": 0 } ] ] }, "subscribe respond": { "main": [ [ { "node": "set_sub_FB_success", "type": "main", "index": 0 } ] ] }, "subscribe error": { "main": [ [ { "node": "set_sub_FB_error", "type": "main", "index": 0 } ] ] }, "Check if we sent": { "main": [ [], [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] }, "Edit Fields": { "main": [ [ { "node": "Call 'Sub-instra-reply-handle-new'", "type": "main", "index": 0 } ] ] }, "Check_Echo": { "main": [ [], [ { "node": "Check_Read", "type": "main", "index": 0 } ] ] }, "Check_Read": { "main": [ [], [ { "node": "Check if we sent", "type": "main", "index": 0 } ] ] }, "set_sub_FB_success": { "main": [ [ { "node": "Call 'SendPBSChat_New'", "type": "main", "index": 0 } ] ] }, "set_sub_FB_error": { "main": [ [ { "node": "Call 'SendPBSChat_New'", "type": "main", "index": 0 } ] ] }, "set_xhash_error": { "main": [ [ { "node": "Call 'SendPBSChat_New'", "type": "main", "index": 0 } ] ] } }, "active": true, "settings": { "executionOrder": "v1", "availableInMCP": false }, "versionId": "ebdd7e2c-8f3a-4005-8aff-8e31926265f4", "meta": { "instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4" }, "id": "6LYoDb7YmZdo1XyqcqB8n", "tags": [] }