Telegram Bot API
🌐 Tiếng Việt

forwardMessage

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

Chuyển tiếp một tin nhắn.

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

Tham số

Tham sốKiểuBắt buộcMô tả
chat_idInteger or StringCóID chat đích
message_thread_idIntegerTùy chọnID chủ đề diễn đàn
direct_messages_topic_idIntegerTùy chọnID chủ đề tin nhắn trực tiếp (Bot API 10.0)
from_chat_idInteger or StringCóID chat nguồn
video_start_timestampIntegerTùy chọnMốc thời gian bắt đầu video (Bot API 10.0)
disable_notificationBooleanTùy chọnGửi không âm thanh
protect_contentBooleanTùy chọnBảo vệ nội dung
message_effect_idStringTùy chọnID hiệu ứng tin nhắn
suggested_post_parametersSuggestedPostParametersTùy chọnĐối tượng JSON SuggestedPostParameters
message_idIntegerCóID tin nhắn cần chuyển tiếp

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/forwardMessage" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"from_chat_id":123456789,"message_id":42}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/forwardMessage",
    json={
        "chat_id": 123456789,
        "from_chat_id": 123456789,
        "message_id": 42
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/forwardMessage`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "from_chat_id": 123456789,
    "message_id": 42
  }),
});
console.log(await res.json());

Hướng dẫn từng bước: API gửi tin nhắn Telegram: hướng dẫn sendMessage với curl, Python và JavaScript