chrishubert / whatsapp-api

This project is a REST API wrapper for the whatsapp-web.js library, providing an easy-to-use interface to interact with the WhatsApp Web platform.
https://www.christophehubert.com
Other
688 stars 333 forks source link

Send Message Type Location #208

Open omalisson opened 3 months ago

omalisson commented 3 months ago

I need to send a location but I can't or I've done something wrong. How do I send a location using latitude and longitude?

edsnit commented 3 months ago

In relation to your problem, this way I was able to send the location

{ 
  "chatId": "5521996xxxx@c.us", 
  "contentType": "Location", 
  "type": "location", 
  "latitude": 51.5074,
  "longitude": -0.1278,
  "name": "London",
  "address": "London, United Kingdom",
  "caption": "teste"
}
omalisson commented 3 months ago

I've managed to send the latitude and longitude, but as well as not opening in the exact location, I can't assign the optional information such as name, url and description. Below is a sample of the output of the message sent via API (incomplete) and another sent via device (complete):

Via API:

Via Device:

Even if I reproduce the "content" with the same information that is sent by the device, the message is cut off as shown in the output above generated by sending via API.

image

omalisson commented 3 months ago

Good evening friend, could you help me, I had no success sending a PDF, do you have any examples to use and see how it is done, thank you in advance.

Hello friend!

I started using this API today and I haven't yet tried sending files (PDF), so I can't help you yet! Sorry!

omalisson commented 3 months ago

In relation to your problem, this way I was able to send the location

I'll try it this way!

omalisson commented 3 months ago

In relation to your problem, this way I was able to send the location

{ "chatId": "5521996xxxx@c.us", "contentType": "Location", "type": "document", "mimetype": "application/pdf", "caption": "teste", "content": "Localizacao" }

It didn't solve my case.

omalisson commented 2 months ago

Olá @stonestecnologia !

Enviar mensagem é bem tranquilo. Pela interface do Swagger é como mostra no print abaixo:

image

Abaixo segue o modelo que uso em shell script para enviar mensagens:

image

O traço amarelo na imagem é o campo da API KEY.