Telegram Bot API
🌐 Türkçe

sendChatAction

Kategori: Mesajlar · Bot API 10.3 · Resmi dokümantasyon

Sohbet eylemi gönderir (typing vb.).

Dönüş değeri: Başarılı olduğunda True döndürür.

Parametreler

ParametreTürZorunluAçıklama
business_connection_idStringİsteğe bağlıİşletme bağlantısı ID'si
chat_idInteger or StringEvetSohbet ID'si
message_thread_idIntegerİsteğe bağlıForum konusu ID'si
actionStringEvettyping, upload_photo, record_video, upload_video, record_voice, upload_voice, upload_document, choose_sticker, find_location, record_video_note, upload_video_note

Parametre açıklamaları kısa özetlerdir; tam metin için resmi dokümantasyona bakın.

Örnek istek

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendChatAction" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"action":"typing"}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/sendChatAction",
    json={
        "chat_id": 123456789,
        "action": "typing"
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendChatAction`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "action": "typing"
  }),
});
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