{"id":"cmGsNvW9bEORABdo","meta":{"instanceId":"workflow-9433edcd","versionId":"1.0.0","createdAt":"2025-09-29T07:07:46.281861","updatedAt":"2025-09-29T07:07:46.281874","owner":"n8n-user","license":"MIT","category":"automation","status":"active","priority":"high","environment":"production"},"name":"Bitrix24 Chatbot Application Workflow example with Webhook Integration","nodes":[{"id":"ddd802bb-0da0-474d-b1e9-74f247e603e0","name":"Bitrix24 Handler","type":"n8n-nodes-base.webhook","position":[0,0],"webhookId":"c3ae607d-41f0-42bc-b669-c2c77936d443","parameters":{"path":"bitrix24/handler.php","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":1,"notes":"This webhook node performs automated tasks as part of the workflow."},{"id":"5676a53e-6758-4ad5-ace6-e494fa10b6c3","name":"Credentials","type":"n8n-nodes-base.set","position":[200,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"030f8f90-2669-4c20-9eab-c572c4b7c70c","name":"CLIENT_ID","type":"string","value":"local.6779636e712043.37129431"},{"id":"de9bbb7a-b782-4540-b259-527625db8490","name":"CLIENT_SECRET","type":"string","value":"dTzUfBoTFLxNhuzc1zsnDbCeii98ZaE5By4aQPQEOxLJAS9y6i"},{"id":"86b7aff7-1e25-4b12-a366-23cf34e5a405","name":"application_token","type":"string","value":"={{ $json.body['auth[application_token]'] }}"},{"id":"69bbcb1f-ba6e-42eb-be8a-ee0707ce997d","name":"domain","type":"string","value":"={{ $json.body['auth[domain]'] }}\n"},{"id":"dc1b0515-f06a-4731-b0dc-912a8d04e56b","name":"access_token","type":"string","value":"={{ $json.body['auth[access_token]'] }}"}]},"includeOtherFields":true},"typeVersion":3.4,"notes":"This set node performs automated tasks as part of the workflow."},{"id":"b72c00cf-9f8c-4c2a-9093-b80d82bab85b","name":"Validate Token","type":"n8n-nodes-base.if","position":[400,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"da73d0ba-6eeb-405e-89fe-9d041fd2e0cd","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.CLIENT_ID }}","rightValue":"={{ $json.application_token }}"},{"id":"4ba90f7b-0299-4097-9ae7-6e4dee428a74","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"1","rightValue":"1"}]}},"typeVersion":2.2,"notes":"This if node performs automated tasks as part of the workflow."},{"id":"f0feb392-873a-4643-b7ad-0e6d9f877e82","name":"Route Event","type":"n8n-nodes-base.switch","position":[600,0],"parameters":{"rules":{"values":[{"outputKey":"YOUR_CREDENTIAL_HERE","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.body.event }}","rightValue":"ONIMBOTMESSAGEADD"}]},"renameOutput":true},{"outputKey":"YOUR_CREDENTIAL_HERE","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e9125f57-129e-4026-86ff-746d40b92b04","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.event }}","rightValue":"ONIMBOTJOINCHAT"}]},"renameOutput":true},{"outputKey":"YOUR_CREDENTIAL_HERE","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2db7bed5-fd88-4900-b8d2-e27b49c2fcca","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.event }}","rightValue":"ONAPPINSTALL"}]},"renameOutput":true},{"outputKey":"YOUR_CREDENTIAL_HERE","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b708d339-fd46-470d-b0d5-ff2eb405f5ce","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.event }}","rightValue":"ONIMBOTDELETE"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2,"notes":"This switch node performs automated tasks as part of the workflow."},{"id":"56fcdc5f-d509-4c9f-a437-79c53add49f8","name":"Process Message","type":"n8n-nodes-base.function","position":[800,0],"parameters":{"functionCode":"// Process Message Node\nconst items = $input.all();\nconst item = items[0];\n\n// Get message data from the correct path\nconst message = item.json.body['data[PARAMS][MESSAGE]'];\nconst dialogId = item.json.body['data[PARAMS][DIALOG_ID]'];\n\n// Get auth data\nconst auth = {\n access_token: item.json.access_token,\n domain: item.json.domain\n};\n\nif (message.toLowerCase() === \"what's hot\") {\n return {\n json: {\n DIALOG_ID: dialogId,\n MESSAGE: \"Hi! I am an example-bot.\\nI repeat what you say\",\n AUTH: auth.access_token,\n DOMAIN: auth.domain\n }\n };\n} else {\n return {\n json: {\n DIALOG_ID: dialogId,\n MESSAGE: `You said:\\n${message}`,\n AUTH: auth.access_token,\n DOMAIN: auth.domain\n }\n };\n}"},"typeVersion":1,"notes":"This function node performs automated tasks as part of the workflow."},{"id":"a647ed67-c812-4416-8c85-55a681bc7f80","name":"Process Join","type":"n8n-nodes-base.function","position":[800,160],"parameters":{"functionCode":"// Process Join Node\nconst items = $input.all();\nconst item = items[0];\n\n// Get dialog ID from the correct path\nconst dialogId = item.json.body['data[PARAMS][DIALOG_ID]'];\n\n// Get auth data\nconst auth = {\n access_token: item.json.access_token,\n domain: item.json.domain\n};\n\nreturn {\n json: {\n DIALOG_ID: dialogId,\n MESSAGE: 'Hi! I am an example-bot. I repeat what you say',\n AUTH: auth.access_token,\n DOMAIN: auth.domain\n }\n};"},"typeVersion":1,"notes":"This function node performs automated tasks as part of the workflow."},{"id":"4aac8853-d80e-4201-9f31-7838d18afe71","name":"Process Install","type":"n8n-nodes-base.function","position":[800,320],"parameters":{"functionCode":"// Process Install Node\nconst items = $input.all();\nconst item = items[0];\n\n// Get the webhook URL from input\nconst handlerBackUrl = item.json.webhookUrl;\n\n// Get auth data directly from item.json\nconst auth = {\n access_token: item.json.access_token,\n application_token: item.json.application_token,\n domain: item.json.domain\n};\n\nreturn {\n json: {\n handler_back_url: handlerBackUrl,\n CODE: 'LocalExampleBot',\n TYPE: 'B',\n EVENT_MESSAGE_ADD: handlerBackUrl,\n EVENT_WELCOME_MESSAGE: handlerBackUrl,\n EVENT_BOT_DELETE: handlerBackUrl,\n PROPERTIES: {\n NAME: 'Bot',\n LAST_NAME: 'Example',\n COLOR: 'AQUA',\n EMAIL: 'no@example.com',\n PERSONAL_BIRTHDAY: '2020-07-18',\n WORK_POSITION: 'Report on affairs',\n PERSONAL_GENDER: 'M'\n },\n // Use the auth data from item.json\n AUTH: auth.access_token,\n CLIENT_ID: auth.application_token,\n DOMAIN: auth.domain\n }\n};"},"typeVersion":1,"notes":"This function node performs automated tasks as part of the workflow."},{"id":"30922462-255b-4ba6-8167-88aec244fdb1","name":"Register Bot","type":"n8n-nodes-base.httpRequest","position":[1000,320],"parameters":{"url":"{{ $env.BASE_URL }}","method":"POST","options":{},"sendBody":true,"bodyParameters":{"parameters":[{"name":"CODE","value":"LocalExampleBot"},{"name":"TYPE","value":"B"},{"name":"EVENT_MESSAGE_ADD","value":"={{$json.handler_back_url}}"},{"name":"EVENT_WELCOME_MESSAGE","value":"={{$json.handler_back_url}}"},{"name":"EVENT_BOT_DELETE","value":"={{$json.handler_back_url}}"},{"name":"PROPERTIES","value":"={{ {\n NAME: 'Bot',\n LAST_NAME: 'Example',\n COLOR: 'AQUA',\n EMAIL: 'no@example.com',\n PERSONAL_BIRTHDAY: '2020-07-18',\n WORK_POSITION: 'Report on affairs',\n PERSONAL_GENDER: 'M'\n} }}"},{"name":"CLIENT_ID","value":"={{ $json.CLIENT_ID }}"},{"name":"CLIENT_SECRET","value":"={{ $json.AUTH }}"}]}},"typeVersion":4.2,"notes":"This httpRequest node performs automated tasks as part of the workflow."},{"id":"8c1c7ebf-d5b3-472e-9d98-34cc65ba86ba","name":"Send Message","type":"n8n-nodes-base.httpRequest","position":[1000,0],"parameters":{"url":"{{ $env.BASE_URL }}","method":"POST","options":{},"sendBody":true,"bodyParameters":{"parameters":[{"name":"DIALOG_ID","value":"={{ $json.DIALOG_ID }}"},{"name":"MESSAGE","value":"={{ $json.MESSAGE }}"},{"name":"AUTH","value":"={{ $json.AUTH }}"}]}},"typeVersion":4.2,"notes":"This httpRequest node performs automated tasks as part of the workflow."},{"id":"af0d2b44-53f7-4c4c-9428-d54ebcf41bff","name":"Send Join Message","type":"n8n-nodes-base.httpRequest","position":[1000,160],"parameters":{"url":"{{ $env.BASE_URL }}","method":"POST","options":{},"sendBody":true,"bodyParameters":{"parameters":[{"name":"DIALOG_ID","value":"={{ $json.DIALOG_ID }}"},{"name":"MESSAGE","value":"={{ $json.MESSAGE }}"},{"name":"AUTH","value":"={{ $json.AUTH }}"}]}},"typeVersion":4.2,"notes":"This httpRequest node performs automated tasks as part of the workflow."},{"id":"9110f66d-1c35-44b4-bc73-18f821b50b71","name":"Process Delete","type":"n8n-nodes-base.noOp","position":[800,480],"parameters":{},"typeVersion":1,"notes":"This noOp node performs automated tasks as part of the workflow."},{"id":"81a5fc23-47a4-4ef8-bfb4-31593aed12fd","name":"Success Response","type":"n8n-nodes-base.respondToWebhook","position":[1200,0],"parameters":{"options":{"responseCode":200},"respondWith":"json","responseBody":"={\n \"result\": true\n}"},"typeVersion":1.1,"notes":"This respondToWebhook node performs automated tasks as part of the workflow."},{"id":"a19f3b0b-496f-4f3d-a9c2-044356070e32","name":"Error Response","type":"n8n-nodes-base.respondToWebhook","position":[400,160],"parameters":{"options":{"responseCode":401},"respondWith":"json","responseBody":"={{\n \"result\": false,\n \"error\": \"Invalid application token\"\n}}"},"typeVersion":1.1,"notes":"This respondToWebhook node performs automated tasks as part of the workflow."}],"active":true,"settings":{"executionOrder":"v1","saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner","errorWorkflow":null,"timezone":"UTC","executionTimeout":3600,"maxExecutions":1000,"retryOnFail":true,"retryCount":3,"retryDelay":1000},"versionId":"401b00c7-dc0c-4067-9b27-27dc171cc52e","connections":{"Bitrix24 Handler":{"main":[[],[],[],[],[],[],[],[],[]]},"Register Bot":{"main":[[],[],[],[],[],[],[],[],[]]},"Send Message":{"main":[[],[],[],[],[],[],[],[],[]]},"Send Join Message":{"main":[[],[],[],[],[],[],[],[],[]]},"Success Response":{"main":[[],[],[],[],[],[],[],[],[]]},"Error Response":{"main":[[],[],[],[],[],[],[],[],[]]}},"description":"Automated workflow: Bitrix24 Chatbot Application Workflow example with Webhook Integration. This workflow processes data and performs automated tasks.","notes":"Excellent quality workflow: Bitrix24 Chatbot Application Workflow example with Webhook Integration. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}