WhatsApp Number Selection
This documentation explains how the system automatically selects which WhatsApp instance to use when sending outbound messages. Understanding this process will help you optimize your setup and troubleshoot messaging issues.
Overview Video
Overview
The WhatsApp Number Selection system determines which WhatsApp instance and phone number to use when sending outbound messages. This system implements a priority-based selection algorithm with comprehensive error handling and fallback mechanisms.
Selection Priority Hierarchy
The system follows a strict priority order to ensure predictable and logical number selection:
Priority 1: Manual Override (Highest)
Use {{ WA#N }} in your message where N is the instance index to force a specific WhatsApp instance number.
When Used: When a message contains a manual override pattern
Example: "This message will go via 2nd instance {{ WA#2 }}"
Behavior:
- Extracts instance index from message pattern
- Validates instance exists and is connected
- Removes pattern from message before sending
The system will throw an error if the specified instance doesn't exist or isn't connected.
Priority 2: Contact Tags
Tag contacts with wa: +1234567890 to always use a specific WhatsApp number for that contact.
When Used: When a contact has a WhatsApp number tag
Example: Contact tagged with wa: +15551234567
Behavior:
- Searches contact tags for WhatsApp number pattern
- Finds instance with matching phone number
Error occurs if the tagged number's instance is not connected.
Priority 3: Contact Assigned To
When a contact is assigned to a user in your CRM, the system will try to use that user's WhatsApp instance for messaging.
When Used: When a contact is assigned to a specific user who has a WhatsApp instance assigned to them
Behavior:
- Looks up contact's assigned user
- Finds WhatsApp instance assigned to that user
Error occurs if the assigned user's instance is not connected.
Priority 4: Default Instance
Always set one instance as "default" for each location to ensure reliable fallback behavior.
When Used: When no specific assignment is found
Behavior:
- Uses the instance marked as "default" for the location
- Only considers connected instances
Priority 5: Any Available Instance (Lowest)
When Used: As final fallback
Behavior:
- Selects any connected instance with a phone number
If no instances are available at this point, the message will fail with Error 106.
Advanced Configuration Examples
Example 1: E-commerce Setup
Instance #1: +1-555-ORDERS (Order confirmations)
- Assigned to: Order Management User
- Usage: Automated order workflows
Instance #2: +1-555-SUPPORT (Default - Customer service)
- Marked as: Default Instance
- Usage: General customer inquiries
Instance #3: +1-555-BILLING (Billing inquiries)
- Contact Tags: VIP customers tagged with "wa: +1-555-BILLING"
- Usage: Payment and billing communications
Example 2: Agency Client Management
Instance #1: Client A Brand Number
- Manual Override: Workflows use `{{ WA#1 }}` for Client A
Instance #2: Client B Brand Number
- User Assignment: Client B team members assigned to Instance #2
Instance #3: Agency Main Line (Default)
- Default Instance: Used for all other communications
Best Practices
Setup Recommendations
- Always Set a Default: Ensure one instance is marked as default for fallback scenarios
- Document Your Strategy: Keep a record of which numbers are used for what purposes
- Test Your Setup: Send test messages to verify number selection works as expected
- Monitor Regularly: Check instance connection status daily
Error Prevention
- Validate Manual Overrides: Ensure
{{ WA#N }}patterns reference existing, connected instances - Maintain Contact Tags: Keep
wa:tags updated when instances change - Review User Assignments: Regularly verify that assigned users have connected instances
- Health Monitoring: Set up alerts for instance disconnections
Troubleshooting Workflow
- Check Error Code: Identify the specific error (101-106)
- Verify Instance Status: Confirm which instances are connected
- Review Configuration: Check user assignments, tags, and default settings
- Test Resolution: Send a test message to verify the fix worked
- Document Issues: Keep a log of common problems and solutions
Related Documentation
- Introduction to Multiple WhatsApp Instances: Overview and use cases
- Error Codes & Handling: Detailed error troubleshooting
- Full Setup Guide: How to connect WhatsApp instances
For additional support with number selection issues, contact our team through the WhatsApp button below.