# Bitrix24

{% hint style="info" %}
Publish to Bitrix24 with the Enterprise plan.
{% endhint %}

{% hint style="warning" %}
Requires a Bitrix24 account.
{% endhint %}

Publishing an AI agent to Bitrix24 allows your audience to interact with the AI agent—and [subsequently with live agents](https://documentation.proto.cx/docs/modules/ai-agents/workflows-and-actions/human-handoff)—in a Bitrix24 thread.

Bitrix24 is a unique channel and integration in that it supports both [human handoff](https://documentation.proto.cx/docs/modules/ai-agents/workflows-and-actions/human-handoff) to a live agent in Proto, *or* [external handoff](https://documentation.proto.cx/docs/modules/ai-agents/workflows-and-actions/external-handoff) to another chat user within the Bitrix24 platform.

In the agent's **Publish** tab, [create a Bitrix24 channel](https://documentation.proto.cx/docs/modules/ai-agents/publishing/..#add-a-channel) or select an existing one from the table to open its settings.

***

## Basic Settings

In the **Basics** accordion, the following options are available:

* **Name** — the internal name of the channel, used to distinguish from any other Bitrix24 channels the agent is published to.
* **Default chat language** — the language used by the AI agent at the start of a new chat. Available languages are set in the agent's [General](https://documentation.proto.cx/docs/modules/manage-ai-agents#general) settings.
* **Icon** — the channel's avatar seen by live agents in the [Inbox](https://documentation.proto.cx/docs/modules/inbox) dashboard.

Press **Save** to confirm edits.

***

## Connecting Bitrix24

In the **Configuration** accordion, a **Bitrix24 address** is required from your Bitrix24 account:

1. Login to Bitrix24.
2. Go to **Settings** > **My Bitrix24** > **Bitrix24 Address** > **Create address/Use own domain**, and copy the address
3. In Proto, paste the address in the **Bitrix24 address** field and press **Verify**. A handler path and initial installation path will be generated.
4. Back in your Bitrix24, go to **Applications** > **Developer Resources** > **Common Use Cases** > **Other** > **Local Application**, and configure the following:
   1. Select **Server**.
   2. Paste in the **handler path** and **initial installation path** from Proto.
5. Press **Save**. An **Application ID** and **Application key** will be generated.
6. In Proto, paste these values into the respective Bitrix24 configuration fields, and press **Save and Verify**.
7. Press **Register** to add the Bitrix24 AI chatbot.

***

#### How to Fix Verification Failed Error / Unable to Enable Bitrix24 Channel Error

1. In Bitrix24, go to **Applications** > **Developer Resources** > **Integrations**, and check if your **Local Application** is successfully created.
2. &#x20;Press **REINSTALL** in the Local Application, and verify the channel again.

***

### Open Channel Setup

If you already have an Open Channel in your Bitrix24 Live Chat, you can add the Local Application chatbot as the first support tier before transferring chats to a live agent. To do so:

1. Go to your **Open Channel** and select **CONFIGURE**.
2. Go to the **Chat Bots** tab and set the following:
   1. Toggle on **Assign chat bot when a client enquiry is received**.
   2. **Select chat bot** — select the **chat bot** created in your Local Application.
   3. **Activate chat bot** — select **Each time a client starts conversation**.
   4. **Transfer conversation from bot to a live agent after** — select any period of time.
   5. **Disconnect chat bot** — select **after transferring the conversation to an agent**.
3. Press **Save**.

{% hint style="info" %}
In your Open Channel **Auto Actions** tab, if **Use CRM form to ask for contact information in the live chat** is enabled, make sure **Show form** is set to **Wait for customer's first message**.
{% endhint %}

***

## Using Bitrix24

After setting up your Open Channel, you can test chatting with the AI agent through the **Chat public link** or the **Open Channel** in your Bitrix24 widget.

***

## Identify Person in Bitrix24 Live Chat

To prevent your signed-in audience members from having to fill in a contact form, embed this JavaScript in the webpage that the Bitrix24 [website widget](https://helpdesk.bitrix24.com/open/8772927/) is on:

```javascript
<script type="text/javascript"> 
window.addEventListener('onBitrixLiveChat', function(event)
{
	var widget = event.detail.widget;

	// Settings external user authentication
	widget.setUserRegisterData({
		'hash': '12b42ebcec7e3c26a313272c26efddbd',
		'name': 'John',
		'lastName': 'Smith',
		'avatar': 'http://files.smith.com/images/avatar-john.jpg',
		'email': 'john@smith.com',
		'www': 'https://bitrix24.com',
		'gender': 'M',
		'position': 'Loyal Customer'
	});
	
});
</script>
```

This script is used to identify an existing User in your Bitrix24 organization. To identify a person in your Bitrix24 CRM Contacts, apply their email address to the `position` field.

***

## Handoff Chats to Bitrix24

See the [External Handoff](https://documentation.proto.cx/docs/modules/ai-agents/workflows-and-actions/external-handoff) action.
