Send message to WhatsApp

Hi,
I would like to know if exist someway how to send message to whatsApp using workflows. Today I can to do this sending a SMS and does works fine;
Tks.

The best option is likely the WhatsApp Business API. This is a REST API that can be accessed using the HTTP Node.

Hi,

Could you send me a exemple please?

tks

Hello @Marcelo_Bohrer,

I don’t have an example of using the HTTP Node specifically with the WhatsApp Business API. For an example of how to use the HTTP Node to make an HTTP request, you can check out our Losant Walkthrough which has an example of how to do this.

Thank you,
Heath

Hi,

I tried to use HTTP node but I don’t know how does work to set a request method “POST”.

Below I did a Python code that does work fine. I would like to do the same into Losant to send message to whatsApp’s api

Please, do you have any ideia about how can I do this?

import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.positus.global")
payload = "{\r\n  \"to\": \"+555199999999\",\r\n  \"type\": \"text\",\r\n  \"text\": {\r\n      \"body\": \"Teste envio mensagem 2 para whats via Python\"\r\n  }\r\n}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}
conn.request("POST", "/v2/sandbox/whatsapp/numbers/<number>/messages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

@Marcelo_Bohrer,

Just as a reminder, please be mindful of posting tokens and passwords in our forums as it is a public space. I have edited your post to remove your token.

You can make POST requests with the HTTP Node by changing the Request Method to POST. There are also fields for you to add information in the Body of the request, as well as adding request headers to your HTTP Request.

There is an example of how to make a POST request with the HTTP node in the InfluxDB How To Guide, specifically Part 4. Although this guide does make HTTP requests locally and between Docker Containers, the HTTP Node configuration is similar, except for the Request URL.

Let me know if this works for you!

Thank you,
Heath

Hi Heath,

Thanks a lot, I can to do. Now it’s works fine.
About the tokens and passwords don’t worry I changed before sent to forum, okay;;;
tks by help

1 Like