Automate Bitrix24 Chatbot with n8n Webhook Integration

Reduce manual chatbot management in Bitrix24 with this n8n workflow that integrates Bitrix24 Webhooks. Save time by auto-processing messages, handling bot joins, installs, and deletions seamlessly.
Webhook
Set
If
+5
Workflow Identifier: 1688
NODES in Use: Webhook, Set, If, Switch, Function, HTTP Request, NoOp, Respond to Webhook

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Opening Problem Statement

Meet Anna, a customer support lead at a growing company using Bitrix24 for team collaboration and client communications. Every day, Anna spends several hours manually managing chatbot interactions—validating incoming messages, ensuring the bot responds correctly, and registering the bot events for smooth operation. The current process is error-prone, inconsistent, and wastes precious time that Anna could better spend analyzing real customer queries or strategizing improvements.

Manual chatbot management leads to frequent mishandled conversations, delayed responses, and strained team resources. Annually, this inefficiency costs Anna’s company hundreds of hours and potential revenue from lost client engagement.

This exact scenario inspired the creation of a powerful n8n workflow automating Bitrix24 chatbot operations, significantly boosting response speed while minimizing human error.

What This Automation Does

This specific n8n workflow leverages Bitrix24’s webhook system to build an automated chatbot management system. Here’s what happens when it runs:

  • Webhook Listener: Captures incoming Bitrix24 chatbot events via POST requests.
  • Token Validation: Ensures messages originate from authorized applications by validating tokens.
  • Event Routing: Routes incoming chatbot events such as new messages, bot joining chats, app installs, and bot deletions to specific processing nodes.
  • Message Processing: Dynamically processes messages, either repeating user input or sending predefined responses.
  • Bot Registration: Automatically registers the chatbot with detailed properties on Bitrix24 during installation events.
  • Response Handling: Sends appropriate success or error responses back to Bitrix24 to maintain synchronous communication.

Overall, this workflow saves Anna and her team countless manual steps, automates the entire chatbot lifecycle, and ensures consistent communication quality. It handles conversational events 100% automatically, freeing up at least 8 hours per week previously spent on bot admin tasks.

Prerequisites ⚙️

  • Bitrix24 Account: Access to a Bitrix24 workspace with imbot permissions.
  • n8n Account: Hosted or self-hosted n8n workflow automation platform.
  • Webhook Access: Publicly accessible webhook URL on your n8n instance to receive Bitrix24 event POST requests.
  • HTTP Request Capability: To make API calls to Bitrix24 for bot registration and messaging.

Optional: For more control, consider self-hosting n8n for seamless webhook exposure and advanced customization.

Step-by-Step Guide

1. Set Up the Webhook Listener Node

Navigate to Bitrix24 Handler (Webhook node). Configure it to listen for POST requests at the path bitrix24/handler.php.

Visual confirmation: When a Bitrix24 event triggers, you should see the request payload appear in the webhook node’s execution pane.

Common mistake: Forgetting to set the HTTP method to POST will cause connection failures.

2. Extract and Assign Credentials

Next, use the Set node named Credentials to extract the application token, domain, and access token from incoming data. Map these to variables like CLIENT_ID, CLIENT_SECRET, and access_token.

This ensures downstream nodes can authenticate API requests securely.

3. Validate Incoming Application Token

Use the If node – Validate Token to compare the incoming application_token against your stored CLIENT_ID. Successful matches proceed further; failures trigger an Error Response.

Expected: Only authorized events should get processed.

4. Route Events Based on Type

Use the Switch node – Route Event to classify incoming events such as ONIMBOTMESSAGEADD (new message), ONIMBOTJOINCHAT (bot joins chat), ONAPPINSTALL (app installation), and ONIMBOTDELETE (bot deletion).

This enables individual handling in dedicated function and HTTP nodes downstream.

5. Process Bot Messages Dynamically

The Function node – Process Message inspects each message’s content. If the message is “what’s hot”, the bot replies with a canned greeting. Otherwise, it echoes back the received text.

Example code snippet from the node:

const message = item.json.body['data[PARAMS][MESSAGE]'];
if (message.toLowerCase() === "what's hot") {
  return { json: { MESSAGE: "Hi! I am an example-bot.nI repeat what you say" } };
} else {
  return { json: { MESSAGE: `You said:n${message}` } };
}

6. Process Bot Joining a Chat

The Function node – Process Join triggers a welcome message each time the bot enters a chat, greeting users automatically.

7. Handle Bot Installation

The Function node – Process Install prepares detailed bot registration info including bot name, email, color, and events URLs.

8. Register the Bot with Bitrix24

The HTTP Request node – Register Bot makes a POST to the Bitrix24 REST API endpoint imbot.register using prepared data and authentication tokens.

Watch for a 200 HTTP status indicating success.

9. Send Bot Response Messages

Use the HTTP Request nodes – Send Message and Send Join Message to post responses back to Bitrix24 chats, leveraging parameters like DIALOG_ID and MESSAGE.

10. Send Webhook Responses Back to Bitrix24

Nodes like Success Response and Error Response reply with HTTP status 200 or 401 and corresponding JSON, ensuring Bitrix24 knows the event processing status.

Customizations ✏️

  • Change Bot Response Text: Modify the Process Message function node’s return message lines to adjust what the bot says for different inputs.
  • Add New Event Routing: In the Route Event switch node, add new case outputs for other supported Bitrix24 events and create corresponding nodes for processing.
  • Update Bot Profile Info: In the Process Install function node, edit properties like NAME, EMAIL, and COLOR to personalize your bot.
  • Enhance Token Validation: Expand the Validate Token node conditions to include multiple valid application tokens or additional security checks.

Troubleshooting 🔧

Problem: “Invalid application token” error response

Cause: The application token sent by Bitrix24 does not match the stored CLIENT_ID.

Solution: Double-check your Set Credentials node and ensure CLIENT_ID matches your Bitrix24 app’s application token.
Also, verify incoming webhook payload contains valid token fields.

Problem: API calls to Bitrix24 REST endpoints fail

Cause: Incorrect access token or domain in HTTP Request nodes.

Solution: Confirm authorization tokens are mapped from the incoming data correctly, especially access_token and domain. Test tokens independently if needed.

Pre-Production Checklist ✅

  • Test the webhook endpoint is publicly reachable and Bitrix24 can send POST requests.
  • Verify the token validation logic with known valid and invalid tokens.
  • Confirm event routing handles each Bitrix24 event you expect to use.
  • Test message processing logic returns appropriate responses.
  • Verify that the bot registration API call responds with success status.
  • Ensure success and error response nodes correctly reply to webhook calls.

Deployment Guide

Once tested, activate the workflow in n8n by setting it to active mode.

Update Bitrix24 webhook integration URL to your n8n webhook URL (e.g., https://your-n8n-instance/bitrix24/handler.php).

Monitor the webhook node and HTTP request nodes execution tabs regularly to catch any errors.

Set alerts or logs in n8n if needed to audit chatbot event activity.

FAQs

Q: Can I use this workflow with other chat platforms?
A: This workflow is specifically tailored for Bitrix24’s chatbot webhook API and event structure. Adapting it to other platforms would require significant modification of event routing and API endpoints.

Q: Does this workflow consume Bitrix24 API call credits?
A: Yes, each HTTP request to Bitrix24 REST endpoints counts toward your API call limits, so monitor usage accordingly.

Q: Is my data secure using this workflow?
A: All data stays within your n8n environment and Bitrix24. Secure your n8n instance, use HTTPS webhook URLs, and protect your tokens carefully.

Conclusion

By following this detailed tutorial, you have automated the full lifecycle of a Bitrix24 chatbot using n8n’s powerful GET and POST automation nodes. No more manual monitoring or message handling—your bot auto-responds, auto-registers, and keeps your chat experience responsive and efficient.

This workflow saves an estimated 8+ hours weekly for chatbot admins, reduces errors, and improves client satisfaction.

Next steps could include extending the bot’s intelligence with AI nodes to enrich replies or adding database nodes to log chat history for analytics.

With your new automation set up, enjoy a more productive and smarter Bitrix24 chatbot experience!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free