Skip to content

SendLocation#

The method is aimed for sending location message. The message will be added to the send queue. Linked device not required when sending. Messages will be kept for 24 hours in the queue until account will be authorized The rate at which messages are sent from the queue is managed by Message sending delay parameter.

Request#

To send location message, you have to execute a request at:

POST https://api.green-api.com/waInstance{{idInstance}}/sendLocation/{{apiTokenInstance}}

For idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
chatId string Yes Chat Id
nameLocation string No Location name
address string No Location address
latitude double Yes Location latitude
longitude double Yes Location longitude
quotedMessageId string No Quoted message Id, if present the message will be sent quoting the specified chat message

Request body example#

Sending a message to a personal chat:

{
    "chatId": "11001234567@c.us",
    "nameLocation": "Restaurant",
    "address": "123456, Perm",
    "latitude": 12.3456789,
    "longitude": 10.1112131
}

Sending a message to a group chat:

{
    "chatId": "11001234567-1581234048@g.us",
    "nameLocation": "Restaurant",
    "address": "123456, Perm",
    "latitude": 12.3456789,
    "longitude": 10.1112131
}

Sending quoted messages:

{
    "chatId": "11001234567@c.us",
    "nameLocation": "Restaurant",
    "address": "123456, Perm",
    "latitude": 12.3456789,
    "longitude": 10.1112131,
    "quotedMessageId": "361B0E63F2FDF95903B6A9C9A102F34B"
}

Response#

Response parameters#

Parameter Type Description
idMessage string Outgoing message Id

Response body example#

{
    "idMessage": "3EB0C767D097B7C7C030"
}

SendLocation errors#

For a list of errors common to all methods, refer to Common errors section

Python request example#

import requests

url = "https://api.green-api.com/waInstance{{idInstance}}/sendLocation/{{apiTokenInstance}}"

payload = "{\r\n    \"chatId\": \"11001234567@c.us\",\r\n    \"nameLocation\": \"Я здесь, приезжай\",\r\n    \"address\": \"613123, Perm\",\r\n   \t\"latitude\": 44.9370129,\r\n    \"longitude\": 89.8728409\r\n}\r\n"
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))