sendLocation
Konum gönderir.
Dönüş değeri: Başarılı olduğunda Message döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
business_connection_id | String | İsteğe bağlı | İşletme bağlantısı ID'si |
chat_id | Integer or String | Evet | Sohbet ID'si veya @username |
message_thread_id | Integer | İsteğe bağlı | Forum konusu ID'si |
direct_messages_topic_id | Integer | İsteğe bağlı | Doğrudan mesajlar konusu ID'si (Bot API 10.0) |
ephemeral_message_parameters | EphemeralMessageParameters | İsteğe bağlı | JSON EphemeralMessageParameters nesnesi — yalnızca tek bir kullanıcıya görünen geçici mesaj (Bot API 10.3) |
latitude | Float | Evet | Enlem |
longitude | Float | Evet | Boylam |
horizontal_accuracy | Float | İsteğe bağlı | Doğruluk (metre, 0-1500) |
live_period | Integer | İsteğe bağlı | Canlı konum süresi (saniye, 60-86400) |
heading | Integer | İsteğe bağlı | Yön (derece, 1-360) |
proximity_alert_radius | Integer | İsteğe bağlı | Yakınlık uyarısı yarıçapı (1-100000) |
disable_notification | Boolean | İsteğe bağlı | Sessiz gönder |
protect_content | Boolean | İsteğe bağlı | İçeriği koru |
allow_paid_broadcast | Boolean | İsteğe bağlı | Ücretli yayına izin ver |
message_effect_id | String | İsteğe bağlı | Mesaj efekti ID'si |
suggested_post_parameters | SuggestedPostParameters | İsteğe bağlı | JSON SuggestedPostParameters nesnesi (kanallar için) |
reply_parameters | ReplyParameters | İsteğe bağlı | JSON ReplyParameters nesnesi |
reply_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | İsteğe bağlı | JSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply |
Örnek istek
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendLocation" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"latitude":51.5007,"longitude":-0.1246}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendLocation",
json={
"chat_id": 123456789,
"latitude": 51.5007,
"longitude": -0.1246
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendLocation`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"latitude": 51.5007,
"longitude": -0.1246
}),
});
console.log(await res.json());
Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma
İlgili metotlar
sendMessageMetin mesajı gönderir.forwardMessageMesajı iletir.forwardMessagesBirden fazla mesajı iletir.copyMessageMesajı, orijinal mesaja bağlantı olmadan kopyalar.copyMessagesBirden fazla mesajı kopyalar.deleteMessageMesajı siler.deleteMessagesBirden fazla mesajı siler.sendChatActionSohbet eylemi gönderir (typing vb.).sendMessageDraftMesaj taslağı gönderir - geçici önizleme (Bot API 9.5+).sendContactKişi gönderir.sendVenueMekan gönderir.setMessageReactionMesaja tepki ayarlar.