# Configuration

To be able to configure a bot on the iAdvize platform, you will need to:

1. [Create the external bot application, in the iAdvize dev platform](#in-the-dev-platform)
2. [Install the external bot application in the iAdvize admin](#install-the-external-bot-application-in-the-iadvize-admin)
3. [Create a bot operator using the newly installed external bot application](#create-a-bot-operator-using-the-newly-installed-external-bot-application)
4. [Distribute your visitors' conversations to your external bot](#distribute-your-visitors-conversations-to-your-external-bot)

{% hint style="warning" %}
In order to be be able to complete this process you will have to implement the [Configuration flow](/technologies/external-bot/implementation/configuration-flow.md) first (or you will be stuck at the “Create bot agent” step)
{% endhint %}

## Create the external bot application in the iAdvize dev platform <a href="#in-the-dev-platform" id="in-the-dev-platform"></a>

First, you hav to be logged in. Then go to “My apps” section, and click on “Build”. In our case we will call it “My bot”. To build a bot, you need to go to “Plugins” then select “Bot”. You have just one URL to set: the base URL of your connector. All the requests will go to this URL.

{% hint style="info" %}
Note that it has to be secured with HTTPS
{% endhint %}

Click on save and… congratulations! You created your bot application. Of course this is just a stub. If you want this to be fully functional you have to implement the [Conversation flow](/technologies/external-bot/implementation/conversation-flow.md).

<figure><img src="/files/grcELgYnp5esOVRXG4YZ" alt=""><figcaption></figcaption></figure>

## **Install the external bot application in the iAdvize admin**

In the [admin](https://ha.iadvize.com/admin/login/), go to “Apps” and mind to select the project you want to install your external bot app on. In the list, find your connector, in our case the “My bot” section. Click on the card. You should land on an installation page such as:

<figure><img src="/files/QTjxAG6eUGNrSk78aUYk" alt=""><figcaption></figcaption></figure>

You just have to click on “Install” and go through the installation process. Finalise the installation by clicking on “Install” and you are done.

You just enabled some bot capabilities on the project you selected. It means that from now on, you can create an operator of type Bot 🎉.

## Create a bot operator using the newly installed external bot application

In the Automation menu, then Bots, click on "Create a bot".

Select "External" then "Create a bot".

<figure><img src="/files/heSWBee6p298400OyZgu" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you do not have any bot application installed on your iAdvize project, you will not see the “External” option in this window.
{% endhint %}

Fill in the different information of your bot:

<figure><img src="/files/rozg8cBc1RB7HkJNSeUa" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A bot operator is associated with ONE and only ONE language. So, if you want your bot to answer several languages, you have to create multiple bot operators.
{% endhint %}

{% hint style="warning" %}
Make sure you specify the right language because **you can't change the language** of a bot.
{% endhint %}

## Distribute your visitors' conversations to your external bot

To be able to chat on iAdvize you need to take several steps:

1. [Install the iAdvize tag on your website](https://help.iadvize.com/hc/en-gb/articles/202575988)
2. Create a campaign
3. Create a targeting rule
4. Create a routing group
5. Create a routing rule

### Create a campaign <a href="#create-a-campaign" id="create-a-campaign"></a>

In the admin, go to “Engagement”. Create a new campaign such as:![Create a bot campaign](https://raw.githubusercontent.com/iadvize/documentation/master/docs/assets/images/bots/create-bot-campaign.png)

### Create a targeting rule <a href="#create-a-targeting-rule" id="create-a-targeting-rule"></a>

Now we need to define “engagement rules” i.e. how to target the visitor. Click on the “➕” and create a rule “Bot”. In our case, we will define that the button is being displayed when the current url contains the name “bot”. Which means you can add ?bot to any url and it will display the notification.

![Create a targeting rule](https://raw.githubusercontent.com/iadvize/documentation/master/docs/assets/images/bots/create-targeting-rule.png)

Add the rule, and publish your campaign.

### Create a routing group <a href="#create-a-routing-group" id="create-a-routing-group"></a>

It is no longer necessary to manually create a routing group since it is automatically created for each bot you create via the "Automation" section.

### Create a routing rule <a href="#create-a-routing-rule" id="create-a-routing-rule"></a>

To finish, we need to create a routing rule. Go to “Routing”, in the upper left select picker, select “Routing rules” and create a rule “Bot targeting”, for the “Bot” notification, that will handover the conversations to the agents of group “\[NAME OF YOUR BOT] chatbot routing group”. Such as:

![Create a bot distribution rule](https://raw.githubusercontent.com/iadvize/documentation/master/docs/assets/images/bots/create-distribution-rule.png)

### Check that everything is correctly setup <a href="#check-that-everything-is-correctly-setup" id="check-that-everything-is-correctly-setup"></a>

Go to “Campaigns” and click on the “edit” button. If you did everything correctly you should see that your campaign is routed this way:

![Check targeting rule](https://raw.githubusercontent.com/iadvize/documentation/master/docs/assets/images/bots/targeting-rule-routed.png)

To sum up, you created a campaign that you associated some engagement rules (when the visitor will see the notification) with, some targeting rules (to which agents the conversations should be handed to).

### Chat with your bot

Last but not least let's trigger the chat. Go to the website you installed the iAdvize tag on. Just append `?bot` to the current URL and reload the page. You should see the chat.

You are ready to chat! 🎉


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iadvize.dev/technologies/external-bot/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
