Telegram Bot API
🌐 Tiếng Việt

sendChatAction

Danh mục: Tin nhắn · Bot API 10.3 · Tài liệu chính thức

Gửi hành động trong chat (đang nhập, v.v.).

Giá trị trả về: Nếu thành công, trả về True.

Tham số

Tham sốKiểuBắt buộcMô tả
business_connection_idStringTùy chọnID kết nối doanh nghiệp
chat_idInteger or StringCóID chat
message_thread_idIntegerTùy chọnID chủ đề diễn đàn
actionStringCótyping, upload_photo, record_video, upload_video, record_voice, upload_voice, upload_document, choose_sticker, find_location, record_video_note, upload_video_note

Mô tả tham số chỉ là bản tóm tắt ngắn gọn; xem tài liệu chính thức để đọc toàn văn.

Ví dụ request

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());

Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên