# Route conversations based on language

<figure><img src="https://3861485111-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU9kiDiTGVD8kkbnKKyEn%2Fuploads%2F7aPAStrcmFHyY2ASQEMh%2Fimage.png?alt=media&#x26;token=dfcd9116-0acf-4f6e-aaba-80fc55f31bd7" alt=""><figcaption><p>Click the image to see the flow in more detail</p></figcaption></figure>

## How it works

{% hint style="info" %}
English, Spanish, and French are the default languages used in this flow, but you can edit these and add the languages that your customers are most likely to speak!
{% endhint %}

1. **Conversation created**: The flow is triggered when an incoming message is received from a customer.
2. **Predict language**: The flow passes the incoming message through an AI language detection action. This tool will analyze the content of the message and determine the language in which it is written, categorizing it as 'English', 'Spanish', or 'French'.
3. **Conditional**: The flow splits into three separate branches, one for each language category (English, Spanish, or French).
4. **Add language tags to a conversation in Inbox**: Within each of the three branches, the next flow action adds a language tag to the conversation. For example, if the message is written in Spanish, it adds a "Spanish" tag to the conversation.
5. **Assign to agent in Inbox**: The next flow action routes the conversation to the agents who have been assigned to handle conversations in that particular language.

## How to use the flow

### What you’ll need

* At least one installed [channel](https://docs.bird.com/applications/channels/channels)
* Three [tags](https://docs.bird.com/applications/inbox/inbox/admin-guide/tags) set up in Inbox (English, Spanish, and French)
* Inbox [agents](https://docs.bird.com/applications/inbox/inbox/admin-guide/agents) with correlating language tags

### How to set up

**Trigger**

1. Go to **Flows** > **Template** **library** and locate and select the ‘Routing Bot: Language’ flow.
2. Click **Save to my library** in the top right-hand corner.
3. The trigger is automatically configured for WhatsApp, but you can change the trigger to a channel of your choice.

**Predict language**

1. If you’ve changed the channel trigger, send a message to that channel, then run a test on the ‘Language detection’ action to identify the language of your message.
2. Click Save when you’re ready to move on.

**Add language tags to a conversation**

1. Select one of the three language branches (English, Spanish, or French).
2. Click the **Add language tags to a conversation in Inbox** action.
3. In the Configuration > Language Tags field, type the name of the language tag that you want to use. For example, if you are using the ‘Spanish’ branch, search for the ‘Spanish’ tag you’ve created for your agents.
4. Click **Run test** to check your tag configuration, then click Next.

**Assign to Agent in Inbox**

1. Click the **Assign to Agent in Inbox** action.
2. Click the **Tags toggle** to turn it on.
3. Click **Next**.

Repeat the ‘Add language tags to a conversation’ and ‘Assign to Agent in Inbox’ steps for each of the remaining two language branches (English and French), then click **Publish flow** to start routing conversations based on language.
