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

messagesText function returns false, fix key 'previewUrl' to 'preview_url' #4

Closed
JoseAndresCartuche opened this issue Sep 22, 2022 · 1 comment

Comments

@JoseAndresCartuche
Copy link

I was testing your flutter package, and sending a simple message with the messagesText function always returned false.
I did the test with Postman, sending the json that is sent with the messagesText function, and I got an error (Status 400).

image

As you can see, the message says Unexpected key 'previewUrl'. I read the Whatsapp Api Documentation and it says that the correct key inside the text object is "preview_url".

I changed the 'previewUrl' key to 'preview_url' and did the test with Postman, and I got the whatsapp message to my phone number.

image
image

So I corrected the key previewUrl to preview_url in the messagesText function, in my proyect.

Map data = {
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "$to",
  "type": "text",
  "text": {"preview_url": previewUrl, "body": "$message"}
};

And when using the function, the WhatsApp message is already sent and returns true.

I hope that you correct the key previewUrl, so that others who use your whatsapp package for flutter do not have the same problem.

@rohit-chouhan
Copy link
Owner

Thanks Jose, for the report!
Now we have modified property from previewurl to preview_url in version 1.0.7

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