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

Add number parameter to OnWhatsAppDto constructor #371

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

judsonjuniorr
Copy link
Contributor

When requesting if the Whatsapp number is valid, if the number sent contains the 9 digit from Brazil, and the result comes without that digit, there's no way to identify the number sent inside the response array.

With this change the response DTO will become like this:
image

With that when the API returns the list of valid numbers I can identify that exact number I sent

@leandrosroc
Copy link
Contributor

With the exact number returned of what was sent, will it be used for comparison or for later sending? because if the jid returned without the ninth digit, then it would later be sent to the person who is in the jid, being registered on WhatsApp

@leandrosroc
Copy link
Contributor

Jid Whatsapp is the most correct number to use when sending

@judsonjuniorr
Copy link
Contributor Author

judsonjuniorr commented Jan 21, 2024

@leandrosroc will be used just for comparison.

Here an example:

Request:

{
  "numbers": [
    "5534998313925",
    "553498313925"
  ]
}

Response:

[
    {
        "jid": "553498313925@s.whatsapp.net",
        "exists": true,
        "number": "5534998313925"
    },
    {
        "jid": "553498313925@s.whatsapp.net",
        "exists": true,
        "number": "553498313925"
    }
]

And then I can compare to save the jid in the database for that number:

[
    "5534998313925",
    "553498313925"
].map(number => {
    const jidValidation = result.find(r => r.number === number)
    const jidExists = jidValidation?.exists ?? false
    const jid = jidValidation?.jid
})

And with this I can store the jid on the database for that specific number.

After storing the jid for that number I can check the validation from my database instead of requesting the validation before sending any message

@leandrosroc
Copy link
Contributor

I understood

@judsonjuniorr
Copy link
Contributor Author

I tried but It's not the exact value, check this example:

Request:

{
  "numbers": [
    "5534998313925",
  ]
}

Response:

[
    {
        "jid": "553498313925@s.whatsapp.net",
        "exists": true,
    }
]

You can see I sent 5534998313925 but the jid number returned is 553498313925 without the 9 digit

@leandrosroc
Copy link
Contributor

I agree, makes sense for the proposed objective

@judsonjuniorr judsonjuniorr mentioned this pull request Jan 21, 2024
@DavidsonGomes DavidsonGomes merged commit 391ffea into EvolutionAPI:develop Jan 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

Successfully merging this pull request may close these issues.

3 participants