whatsapp-api icon indicating copy to clipboard operation
whatsapp-api copied to clipboard

Send Message Type Location

Open omalisson opened this issue 1 year ago • 7 comments

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?

omalisson avatar May 06 '24 22:05 omalisson

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

{ 
  "chatId": "[email protected]", 
  "contentType": "Location", 
  "type": "location", 
  "latitude": 51.5074,
  "longitude": -0.1278,
  "name": "London",
  "address": "London, United Kingdom",
  "caption": "teste"
}

edsnit avatar May 07 '24 02:05 edsnit

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:

  • Code: { "chatId": "[email protected]", "contentType": "Location", "content": { "Location": { "latitude":-22.911632, "longitude":-43.578438, "name":"Craque do Pão", "url":"https://foursquare.com/v/5682faa2498e01df84e8efb8", "description":"Craque do Pão" } } }

  • Output (webhook) {"latitude":-22.911632,"longitude":-43.578438,"description":""}

Via Device:

  • Output (webhook) {"latitude":-22.911632,"longitude":-43.578438,"name":"Craque do Pão","url":"https://foursquare.com/v/5682faa2498e01df84e8efb8","description":"Craque do Pão"}

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

  • Enviada via Device: (description ok) image

omalisson avatar May 07 '24 02:05 omalisson

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 avatar May 07 '24 02:05 omalisson

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

I'll try it this way!

omalisson avatar May 07 '24 02:05 omalisson

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

{ "chatId": "[email protected]", "contentType": "Location", "type": "document", "mimetype": "application/pdf", "caption": "teste", "content": "Localizacao" }

It didn't solve my case.

omalisson avatar May 07 '24 02:05 omalisson

Hi, Allison, eu tb sou do BR, voce consegue usar essa api ? como que vc envia um texto simples para um numero ?

stonestecnologia avatar Jun 16 '24 00:06 stonestecnologia

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.

omalisson avatar Jun 18 '24 20:06 omalisson