What This Automation Does
This workflow automates Bitrix24 chatbot handling in n8n. It stops manual errors and saves time by processing chatbot events automatically. It listens to incoming webhook events, checks tokens, routes events by type, sends reply messages, registers bots, and sends feedback to Bitrix24.
The main goal is to reduce human work in managing chatbot conversations and event registrations. The outcome is faster, more reliable chatbot responses and less time spent on chatbot setup and management.
Who Should Use This Workflow
Anyone using Bitrix24 chatbot who wants to save time and reduce errors in bot event handling. Perfect for support leads or admins who manage conversations daily.
Good for teams wanting consistent replies and automatic bot lifecycle management inside Bitrix24 with minimal manual work.
Tools and Services Used
- Bitrix24 Webhook API: Sends chatbot event data via POST requests.
- n8n Automation Platform: Receives events, makes API calls, runs logic.
- Bitrix24 REST API: Registers chatbot and posts messages to chats.
- HTTP Request Node: Makes API calls within n8n.
- Function Node: Processes and generates messages dynamically.
Inputs, Processing, and Outputs
Inputs
- POST webhook requests from Bitrix24 with chatbot event data.
- Application token and access token included in the request body.
- Event type codes like ONIMBOTMESSAGEADD or ONAPPINSTALL.
Processing Steps
- Listen for POST requests on the webhook URL (Webhook node).
- Extract tokens and domain info (Set node named Credentials).
- Validate incoming application token against stored CLIENT_ID (If node – Validate Token).
- Route event types to different nodes (Switch node – Route Event).
- Process messages; reply with predefined message or echo input (Function node – Process Message).
- Handle bot join chat event and send welcome message (Function node – Process Join).
- Prepare bot registration data during app install events (Function node – Process Install).
- Register chatbots via Bitrix24 REST API (HTTP Request node – Register Bot).
- Send message replies to chats using API (HTTP Request nodes – Send Message and Send Join Message).
- Send success or error HTTP responses back to Bitrix24 (Success Response and Error Response nodes).
Outputs
- Correct reply messages posted in Bitrix24 chats automatically.
- New chatbots registered correctly with Bitrix24 API.
- HTTP status 200 or errors sent to Bitrix24 to confirm processing results.
- Reduced manual bot management and faster chatbot lifecycle operation.
Beginner step-by-step: How to build this in n8n
Import Workflow
- Download the workflow file using the Download button on this page.
- Inside the n8n editor, go to the menu and choose “Import from File”.
- Upload the downloaded workflow JSON file.
Configure Credentials and Settings
- Set API Keys or credentials in the Set node named Credentials as needed.
- Update any bot profile info such as ID, name, emails, or colors in the Function node – Process Install.
- Check and update chat IDs, emails, or folder names if needed for posting messages.
Test the Workflow
- Trigger the workflow manually or send a test POST from Bitrix24 to confirm the webhook is receiving data.
- Watch the execution logs in n8n to see if the flow passes token validation and routes events.
- Fix any errors like invalid tokens or failed HTTP calls at this stage.
Activate for Production
- Once tested, activate the workflow toggle to “ON” in n8n.
- Update the Bitrix24 webhook configuration to point to the active n8n webhook URL (ex: https://your-n8n-instance/bitrix24/handler.php).
- Monitor webhook calls and logs regularly for errors or failures.
For better control, consider self-host n8n so webhook URLs are stable and accessible.
Customization Ideas
- Change responses by editing the message lines in Function node – Process Message.
- Add more event types in Switch node – Route Event to support other Bitrix24 events.
- Personalize bot details like name, email, and color in Function node – Process Install.
- Add more token checks or multiple valid tokens in If node – Validate Token.
Troubleshooting Common Problems
Invalid application token error: Check if the Set node named Credentials has correct CLIENT_ID matching Bitrix24 app token. Confirm incoming webhook includes right tokens.
API calls fail: Verify access_token and domain are correctly mapped to HTTP Request nodes. Test these outside the workflow if needed.
Make sure webhook URL is publicly accessible and set to accept POST requests.
Pre-Production Checklist
- Webhook URL publicly reachable for Bitrix24 to POST events.
- Token validation logic tested with known valid and invalid tokens.
- Event routing correctly handles all expected events.
- Message processing returns expected replies for test inputs.
- Bot registration HTTP requests succeed with 200 response.
- Success and error response nodes correctly send feedback to Bitrix24.
Deployment Guide
Activate the workflow in the n8n editor.
Update Bitrix24 webhook integration with the live n8n webhook URL.
Check execution logs to catch any errors during event processing.
Use alerts or log nodes in n8n if monitoring bot activity is important.
Summary of Benefits
→ The workflow automates chatbot event handling in Bitrix24.
→ It reduces manual workload and errors in bot message management.
✓ Saves at least 8 hours per week in manual chatting tasks.
✓ Ensures consistent chatbot responses in conversations.
✓ Automatically registers bots without manual API calls.
✓ Sends success or error status back to Bitrix24 for tracking.
