2
My system is a CRM and dynamically we put a link that opens the conversation on Whatsapp with the customer. However last week came to present problems in it.
The link we are generating is similar to this:
<a href="https://api.whatsapp.com/send?phone=554799999XXXX&text=teste">Conversar pelo WhatsApp</a>
I tested by replacing the url with wa.me/554799999XXXX
, but the behavior is the same.
When the link is to a DDD 47, and the link has the ninth digit, it directs to a conversation of a contact that has no relation to the same number without the ninth digit. As if it were a new number. And without the ninth digit goes into the normal conversation.
When the link is for a DDD 12 (tested with others who have the same behavior), the opposite occurs, the link with the ninth digit works correctly, already without the ninth digit has an error saying that the number does not exist.
I will try to illustrate with some images to see if someone goes through the same.
In the image above are two links to the same number, the first without the ninth digit, and the second including the ninth digit. It is possible to notice that in the second he considers as if it were a new contact, even being the same number. In this case, even if I send a message to the contact with the ninth digit, the original account will not receive the message.
However, if I try to do the same with a DDD 12 from a contact I have here. The problem is another.
Opera summary: I need the link to work by default in order to generate the link. Until now it was always generating with the ninth digit, started to present this problem recently. I thought about taking out the ninth digit to solve my problem, but soon I realized that it would not solve.
Has anyone gone through the same? Is there a more concrete solution to this? Or some way to generate the link that I haven’t tried?
--EDIT--
I don’t know why the moderation decided to close my question, I even removed the question because of that. But considering they came to me in private because they have the same problem, and knowing that there are people on twitter complaining about it, I decided to restore the question and put here what we found so far.
Just like most who are going through the same, we contact the support of Whatsapp and their response is standard: "We know the problem and we have no date to solve".
In contact with another company with the same problem, we identified that Whatsapp when correcting the ninth digit for some Ddds, they ended up duplicating accounts with Ddds 31 up. Therefore, accounts with DDD below 31 must be contacted with the ninth digit, and accounts with DDD 31 up must have 9 removed as messages will go to the duplicate account.
My co-worker posted a possible solution to the case in his github.
<?php
echo (validateWhatsapp("11991004841"));
public function validateWhatsapp($mobile) {
$ddd = substr($mobile, 0, 2);
$number = substr($mobile, -8);
if ($ddd >= 31) {
$mobile = "55".$ddd.$number;
} else {
$mobile = "55".$ddd."9".$number;
}
return $mobile;
}