Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] With Mexican and Arg Numbers +52 #1004

Open
aldoximple opened this issue Feb 26, 2024 · 1 comment
Open

[Issue] With Mexican and Arg Numbers +52 #1004

aldoximple opened this issue Feb 26, 2024 · 1 comment

Comments

@aldoximple
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @bot-whatsapp/provider@0.1.38 for the project I'm working on.

When I was using Mexican phone number with meta provider a '1' character to the body.to property. So this cause an invalid number.

Here is the diff that solved my problem:

diff --git a/node_modules/@bot-whatsapp/provider/lib/meta/index.cjs b/node_modules/@bot-whatsapp/provider/lib/meta/index.cjs
index 5bbdeb3..e8d8b86 100644
--- a/node_modules/@bot-whatsapp/provider/lib/meta/index.cjs
+++ b/node_modules/@bot-whatsapp/provider/lib/meta/index.cjs
@@ -579,6 +579,13 @@ class MetaProvider extends ProviderClass {
      * @return {Object} The response data from the API.
      */
     async sendMessageToApi(body) {
+        if (body.to.slice(0, 2) == '52') {
+            if (body.to.length > 12) {
+                let lada = body.to.slice(0, 2)
+                let number = body.to.slice(3, 14)
+                body.to = lada+number
+            }
+        }
         try {
             const response = await axios.post(`${URL$1}/${this.version}/${this.numberId}/messages`, body, {
                 headers: {

This issue body was partially generated by patch-package.

@rodrimarchese
Copy link
Contributor

rodrimarchese commented Apr 19, 2024

Pueden usar versión 1.1.4-alpha.0 soluciona el problema para números méxicanos y argentinos
Fixed en #1044

@leifermendez leifermendez changed the title [Issue] With Mexican Numbers +52 [Issue] With Mexican and Arg Numbers +52 Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants