facebook-graph-apiwhatsapp-cloud-api

Issue with Formatting Argentine Phone Numbers in WhatsApp API


everyone.

I'm working with the WhatsApp Cloud API and I have encountered a problem when registering Argentine phone numbers. I expected the Meta Platform stores the numbers in the standard international format, but that's not what's happening.

When I try to register an Argentine number, for example, +54 9 11 3795-3504, the Platform stores it differently. For instance, a number I registered was stored as +54 11 15-7889-3530. I'm confused as to why the API is altering the number's format, especially adding the "15", which is no longer used in the international format.

Curiously, after that, when I try to send a message to from this number that I stored, I receive this number in the webhook like +54 11 15-7889-3530, but when I try to send a message to this number, the API expect that I send to this other +54 9 11 3795-3504, otherwise, don't give me an error "(#131030) Recipient phone number not in allowed list"

Has anyone else faced a similar issue or has any idea why this is happening? Is there a specific setting in the WhatsApp API that I need to adjust to properly handle Argentine phone numbers?

Any guidance or suggestions will be greatly appreciated.

Thank you in advance.


Solution

  • I could solved it sending with a fragment of the phone number that I received in the webhook of API Cloud.

    For example:

     function webhookHandler(req, res) {
      // I received on clientPhone this number: '54911XXXXXXXX'
      const clientPhone = req.entry.at(0).value.contactMessages.contacts[0].wa_id;
    
      // deliverTo is the phone where I need send a message. 
      let deliverTo = clientPhone;
      if (clientId.value.slice(0, 2) === '54'){
        deliverTo = `54${clientPhone.slice(3)}`;
      } 
    }
    

    Only for Argentian numbers Meta needed that I sent messages to its API to the phone number with this format: '541115XXXXXXXX'. But I discovered that Meta allow u send messages to '5411XXXXXXXX' (the number that I received without 9).

    This is important because with that, we can transform the phone number incoming in the another number.

    If u want to test that like a developer, you can add the phone number on WhatsApp phone number list like this '5411XXXXXXXX' (the number without 9) and since that you can test.