Use this method to send a location and point on a map. On success, the sent message is returned.
Field
Type
Required
Description
method
String
Yes
"sendLocation"
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
longitude
String
Yes
longitude
latitude
String
Yes
latitude
name
String
Optional
Location name
details
String
Optional
Location details
caption
String
Optional
Location caption: 0-256 characters.
disable_web_page_preview
Boolean
Optional
Disables link previews for links in this message.
disable_notification
Boolean
Optional
Sends the message silently: users will receive a notification with no sound.
reply_to_message_id
String
Optional
IUnique identification for the original parent message if the message is a reply.
reference
Long
Yes
Unique local identifier for the target Chat or User.
to_user_id
String
Optional
Unique identifier of the target user if a user replies or sends a message to the target user within a Group or Channel.
echo
Integer
Optional
1= repeat message 0= no echo
menu_ref
String
Optional
Menu reference for an existing predefined menu: the menu will be displayed as an inline menu associated with the message.
inline_menu
Array of Menu
Optional
Inline menu object to hold menus: if both inline_menu and menu_ref are defined, the priority goes to inline_menu.
chat_settings
Integer
Optional
1: if you want to send to bot chat settings

Requests

json
{ "method": "sendLocation", "chat_id": "65854410236988521", "reference": 80613906787070, "latitude": "29.9740559", "longitude": "31.482059", "caption": "Stanley Store" }
java
// SEND LOCATION else if (incomingMsg.getText().toLowerCase().equals("location")) { LocationOutMessage locMsg = new LocationOutMessage(); locMsg.setChatId(incomingMsg.getChat().getId()); locMsg.setReference(Utils.getUniqueId()); locMsg.setName("Cairo International Airport"); locMsg.setDetails("Cairo, Egypt"); locMsg.setLatitude("30.102366"); locMsg.setLongitude("31.426319"); locMsg.setCaption("Cairo Airport Location From Bot"); api.send(locMsg); }
javascript
let locationOutMsg = new LocationOutMessage(); locationOutMsg.chat_id = incomingMsg.chat.id; locationOutMsg.reference = Id(); locationOutMsg.name = incomingMsg.location.name; locationOutMsg.details = incomingMsg.location.details; locationOutMsg.latitude = incomingMsg.location.latitude; locationOutMsg.longitude = incomingMsg.location.longitude; locationOutMsg.caption = "Location From Bot"; api.send(JSON.stringify(locationOutMsg));
python
napi.send_location("chatId","Lat","Lng",Utils.get_unique_id())

Response

json
{ "method": "message", "message": { "date": 1600168078602, "reference": 2097, "chat": { "name": "Alice Park", "id": "90089668723575679", "terminal": "Mobile", "type": "Contact", "version": "('0HNt','1QBk','2c2H','31RN')" }, "sent_to": { "id": "90091903321704167" }, "message_id": "i1_CD11KwDr126551", "style": 6, "from": { "name": "Alice Park", "id": "90089668723575679", "terminal": "Mobile", "type": "Contact", "version": "('0HNt','1QBk','2c2H','31RN')" }, "text": "Hello", "type": "text" } }

Powered by Notaku