Skip to main content

How to Route Conversations Based on Country Code

Learn how to send different language messages and assign agents based on the customer's country code using automation flows.

Updated this week

If you serve customers from multiple countries, you can automatically route conversations and send messages in their preferred language based on their phone number's country code. This guide shows you how to set up country-based routing using conditions in Spur automation flows.

Why Route by Country Code?

Routing by country code allows you to:

  • Send messages in the customer's language (French for France, Arabic for UAE, etc.)

  • Assign agents who speak the customer's language

  • Personalize the customer experience based on their location

Note: This feature only works for WhatsApp, since phone numbers include country codes. Instagram and Facebook don't provide country codes, so routing by location isn't possible on those platforms.

How Country Code Routing Works

You'll use a Condition block in your automation flow to check the customer's phone number. Based on the country code, you can:

  1. Send a message in the appropriate language

  2. Assign the conversation to a specific agent or team

  3. Trigger different flows for different regions

Example 1: Sending Order Confirmation in Different Languages

Let's say you want to send an order confirmation message in French for customers from France and Belgium, and in English for everyone else.

Step 1: Create a New Flow

  1. Go to Automations in Spur

  2. Click + New Workflow

  3. Add a trigger: Shopify: Order Created

Step 2: Add a Condition to Check Country Code

  1. Click the + button to add a new block

  2. Select Condition from the Logic section

Step 3: Set Up Conditions for French-Speaking Countries

  1. In the condition settings, click Add Condition

  2. Set the variable to: {{contact.number}}

  3. Set the operator to: begins with

  4. Set the value to: +33 (France)

  5. Click + Add Condition to add another condition in the same group

  6. Set the operator to: begins with

  7. Set the value to: +32 (Belgium)

Why group them together?
If either condition is true (the number starts with +33 or +32), the flow will proceed to send the French message.

Step 4: Add a French Template Message

  1. Connect the True branch of the condition to a WhatsApp message block

  2. Select a French template (e.g., "Order Confirmation - French")

  3. Configure the template with the order details

Important: Since this is triggered by an order creation, you may not have an active 24-hour messaging window with the customer. That's why you must use a template message (not a regular free form text message).

Step 5: Add an English Template for Everyone Else

  1. Connect the None of the conditions match branch to another WhatsApp message block

  2. Select an English template (e.g., "Order Confirmation - English")

  3. Configure the template with the order details

Flow Diagram:

Shopify: Order Created    ↓ 

Condition: Does contact.number begin with +33 or +32? ↓

Yes → Send French Template ↓
No → Send English Template

Example 2: Routing "Hi" Messages by Language

Let's say customers message you with "Hi" and you want to reply in their language.

Step 1: Create a Keyword Trigger

  1. Create a new flow.

  2. Add a trigger: WhatsApp: Keyword.

  3. Set the keyword to: hi (or hello).

Step 2: Add Conditions for Each Language

French Reply (France & Belgium):

  1. Add a Condition block.

  2. Create a condition group:

    • {{contact.number}} begins with +33 (France)

    • {{contact.number}} begins with +32 (Belgium)

  3. Connect the True branch to a WhatsApp message block.

  4. Write your French reply (e.g., "Bonjour! Comment puis-je vous aider?")

Arabic Reply (UAE):

  1. In the same Condition block, add a new condition group (not in the same group as French).

  2. Set:

    • {{contact.number}} begins with +971 (UAE)

  3. Connect this condition to a WhatsApp message block.

  4. Write your Arabic reply (e.g., "مرحبا! كيف يمكنني مساعدتك؟")

English Reply (Everyone Else):

  1. Connect the None of the conditions match branch to a WhatsApp message block.

  2. Write your English reply (e.g., "Hi! How can I help you?")

Flow Diagram:

WhatsApp: Keyword "hi"     ↓ 

Condition: What country is the customer from? ↓

+33 or +32 → French Reply ↓

+971 → Arabic Reply ↓

None match → English Reply

Example 3: Assigning Agents Based on Country

You can also assign conversations to specific agents based on the customer's country.

Step 1: Add a Condition to Check Country Code

  • Use a Condition block to check {{contact.number}} (similar to Example 2).

Step 2: Add an Action to Assign an Agent

  1. Connect the True branch (e.g., for UAE customers) to an Action block.

  2. Select Assign ticket to agent.

  3. Choose the agent who speaks Arabic.

Step 3: Repeat for Other Countries

  • Add separate conditions and actions for each country/language group.

Flow Diagram:

WhatsApp: Keyword "hi"     ↓ 

Condition: Is contact.number +971 (UAE)? ↓

Yes → Assign to Arabic-speaking agent ↓

No → Assign to default agent

Important: Handling Numbers With and Without the "+" Symbol

Sometimes, phone numbers come with a "+" sign (e.g., +44) and sometimes without (e.g., 44). This depends on how the number is formatted by Shopify, WhatsApp, or other integrations.

To ensure your flow works in both cases, always add two conditions in the same condition group for each country code:

Example: UK Country Code (+44)

Condition Group:

  • {{contact.number}} begins with +44

  • {{contact.number}} begins with 44

This way, whether the number is formatted as +447123456789 or 447123456789, the condition will still match.

Why This Matters:

When using triggers like Shopify: Order Created, Shopify may send the phone number with or without the "+" sign. By including both formats in your condition, you ensure the flow works regardless of how the number is formatted.


Country Codes Reference

Here are some common country codes you might use:

Country

Country Code (with +)

Country Code (without +)

France

+33

33

Belgium

+32

32

UAE

+971

971

UK

+44

44

USA

+1

1

India

+91

91

Australia

+61

61

Germany

+49

49

Spain

+34

34

For a full list of country codes, search for "international calling codes" online.


Best Practices

Always use template messages when triggered by events like "Order Created" (since you may not have a 24-hour messaging window open with the person).

Include both + and non-+ formats in your conditions to handle all number formats.

Group related country codes together (e.g., France and Belgium both use French, so group them in one condition).

Use separate condition groups for different languages (don't put French and Arabic conditions in the same group).

Test your flow with different phone number formats to ensure it works correctly.

Assign agents based on language skills, not just country, to provide the best customer experience.


Frequently Asked Questions

Q: Can I route by country on Instagram or Facebook?

A: No. Instagram and Facebook don't provide country codes, so you can only route by country on WhatsApp.


Q: What if the customer's number doesn't have a country code?

A: If the number doesn't include a country code, the condition won't match, and the flow will proceed to the "None of the conditions match" branch (usually you'd want to connect your default English message to this).


Q: Can I assign different agents for different countries?

A: Yes! After checking the country code with a condition, you can use an Action block to assign the conversation to a specific agent or team.


Q: Do I need to create separate templates for each language?

A: Yes. If you're reaching out to the customer first, you need to create and get approval for templates in each language you want to use (e.g., a French template, an Arabic template, etc.). Submit these templates in Meta Business Manager.


Q: What if I want to support more than 3 languages?

A: You can add as many condition groups as you need. Just create a separate condition group for each language/country code and connect it to the appropriate message or action.


Summary

Task

How To Do It

Route by country code

Use a Condition block to check {{contact.number}} with "begins with"

Send French message

Check if number begins with +33 or +32 or 33 or 32

Send Arabic message

Check if number begins with +971

Handle + and non '+' formats

Always include both +44 and 44 in the same condition group

Assign agents by country

Use an Action block to assign tickets after checking country code

Use templates for order events

Always use templates when triggered by events like "Order Created"


Need help setting up country-based routing? Reach out to our support team anytime :)

Did this answer your question?