Skip to content

sendLocation

Use this method to send point on the map. On success, the sent Message is returned.

Parameters

business_connection_idStringOptional
Unique identifier of the business connection on behalf of which the message will be sent
chat_idIntegerStringRequired
Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_thread_idIntegerOptional
Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idIntegerOptional
Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
latitudeFloatRequired
Latitude of the location
longitudeFloatRequired
Longitude of the location
horizontal_accuracyFloatOptional
The radius of uncertainty for the location, measured in meters; 0-1500
live_periodIntegerOptional
Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
headingIntegerOptional
For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
proximity_alert_radiusIntegerOptional
For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
disable_notificationBooleanOptional
Sends the message silently. Users will receive a notification with no sound.
protect_contentBooleanOptional
Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanOptional
Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idStringOptional
Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersOptional
A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersReplyParametersOptional
Description of the message to reply to
Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user

Returns

On success, the Message object is returned.

GramIO Usage

ts
// Send a static location (office address)
bot
.
command
("office", (
ctx
) =>
ctx
.
sendLocation
(48.8584, 2.2945)
);
ts
// Reply with a location with accuracy radius
bot
.
command
("meethere", (
ctx
) =>
ctx
.
replyWithLocation
(37.7749, -122.4194, {
horizontal_accuracy
: 50,
}) );
ts
// Start a live location that updates for 1 hour
bot
.
command
("track", async (
ctx
) => {
const
msg
= await
ctx
.
sendLocation
(55.7558, 37.6173, {
live_period
: 3600, // 1 hour in seconds
heading
: 90, // facing East
}); // Save msg.messageId to update it later via editMessageLiveLocation });
ts
// Update a live location with new coordinates
await 
bot
.
api
.
editMessageLiveLocation
({
chat_id
: 123456789,
message_id
: 42,
latitude
: 55.7600,
longitude
: 37.6200,
heading
: 180,
});
ts
// Stop a live location early
await 
bot
.
api
.
stopMessageLiveLocation
({
chat_id
: 123456789,
message_id
: 42,
});
ts
// Direct API call — send a static location with proximity alerts enabled
await 
bot
.
api
.
sendLocation
({
chat_id
: 123456789,
latitude
: 51.5074,
longitude
: -0.1278,
live_period
: 86400,
proximity_alert_radius
: 500, // alert when within 500 m
});

Errors

CodeErrorCause
400Bad Request: chat not foundchat_id is invalid or the bot has no access
400Bad Request: LOCATION_INVALIDlatitude or longitude is out of valid range (±90 / ±180)
400Bad Request: wrong live_periodlive_period is not between 60 and 86400 (or the special 0x7FFFFFFF)
400Bad Request: wrong headingheading is outside the 1–360 degree range
400Bad Request: wrong proximity_alert_radiusproximity_alert_radius is outside the 1–100000 meter range
403Forbidden: bot was blocked by the userUser blocked the bot — catch and mark as inactive
429Too Many Requests: retry after NRate limit hit — check retry_after, use auto-retry plugin

TIP

Use GramIO's auto-retry plugin to handle 429 errors automatically.

Tips & Gotchas

  • heading and proximity_alert_radius only apply to live locations. If you set them without live_period, they are ignored silently. Only include them when live_period is set.
  • live_period of 0x7FFFFFFF (2147483647) creates an indefinitely-updatable live location. It won't expire automatically — you must call stopMessageLiveLocation to end it.
  • Save the returned message_id to update live locations. You'll need both chat_id and message_id when calling editMessageLiveLocation or stopMessageLiveLocation.
  • ctx.sendLocation(lat, lon, params?) — note the argument order. Latitude comes first, longitude second. This matches GramIO's method signature and differs from how some map libraries order coordinates.
  • horizontal_accuracy range is 0–1500 meters. Values outside this range cause a 400 error. Use 0 or omit the field if you don't have an accuracy value.
  • Venue vs. Location. If you're sharing a named place (business, landmark), prefer sendVenue — it shows a name and address alongside the map pin.

See Also