[CHATWOOT][Feature] Merge brazilian contacts on chatwoot
Here in Brazil we have a problem. Some years ago we've added on all mobile numbers an extra 9 at beginning. But a lot of whatsapp accounts had already registered without that.
So, whatsapp deal with it handling contacts with and without 9 on same chat.
In chatwoot integration by Waha it doesnt. If a user create a manual contact, with the 9 extra, they send a message normally. But when receive a message, the number come without the 9, so waha create a new contact and a new conversation.
Describe the solution you'd like
Detect and merge contacts when receive a message.
Describe alternatives you've considered
I've did a script directly on my database to deal with it, using the endpoint /api/v1/accounts/%s/actions/contact_merge on chatwoot api (poor documented)
Also had search Waha documentation about contacts creation event, but have no luck.
Examples:
Create a contact with number then send a message.
55 31 9 8888-8888 (55=country code, 31=local code, 9 extra, original number)
When receive a answer for this number, if its registered without 9 (about 90% of the brazilian numbers) they come in like this:
55 31 8888-8888
Both numbers are valid on Whatsapp. Idk why they did it, but... you know politicians.
☝️
related
- https://github.com/devlikeapro/waha/issues/238
- https://waha.devlike.pro/docs/how-to/contacts/#check-phone-number-exists
My solution for this in evolutionapi
https://github.com/EvolutionAPI/evolution-api/pull/587/files
+1
+1
+1
+1
+1
+1
+1
I want to support this request. We also have the same problem with numbers in Brazil — many users reply without the extra 9, and this creates duplicate contacts and conversations in WAHA + Chatwoot. A normalization or merge solution would solve a real pain point for us.
+1
A normalization is the way to go 👍 don’t want to use an undocumented API 🤔
So WAHA will insert 9 (if not already) in all Brazil +55 JIDs — let’s assume [email protected]:
- Try to find a contact with
phone_number = 5531988888888. If found, update its custom attributes with the chat ID[email protected]. - If not found, create a contact with
phone_number = 5531988888888and chat ID[email protected].
🧩 Apps
2025.9.6 - ChatWoot - add additional 9 in Brazil phone numbers - #1261