copyMessage
원본 링크 없이 메시지를 복사합니다.
반환값: 성공 시 반환값: MessageId.
매개변수
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
chat_id | Integer or String | 예 | 대상 채팅 ID |
message_thread_id | Integer | 선택 | 포럼 토픽 ID |
direct_messages_topic_id | Integer | 선택 | 다이렉트 메시지 토픽 ID (Bot API 10.0) |
from_chat_id | Integer or String | 예 | 원본 채팅 ID |
message_id | Integer | 예 | 복사할 메시지 ID |
video_start_timestamp | Integer | 선택 | 동영상 시작 타임스탬프 (Bot API 10.0) |
caption | String | 선택 | 새 캡션 (0-1024) |
parse_mode | String | 선택 | HTML, Markdown, MarkdownV2 |
caption_entities | Array of MessageEntity | 선택 | 캡션용 MessageEntity JSON 배열 |
show_caption_above_media | Boolean | 선택 | 미디어 위에 캡션 표시 |
disable_notification | Boolean | 선택 | 알림 없이 전송 |
protect_content | Boolean | 선택 | 콘텐츠 보호 |
allow_paid_broadcast | Boolean | 선택 | 유료 브로드캐스트 허용 |
message_effect_id | String | 선택 | 메시지 효과 ID |
suggested_post_parameters | SuggestedPostParameters | 선택 | SuggestedPostParameters JSON 객체 |
reply_parameters | ReplyParameters | 선택 | ReplyParameters JSON 객체 |
reply_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | 선택 | JSON 객체: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply |
요청 예제
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/copyMessage" \
-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}/copyMessage",
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}/copyMessage`, {
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());
단계별 가이드: 텔레그램 봇 API로 메시지 보내기: sendMessage 사용법과 예제
관련 메서드
sendMessage텍스트 메시지를 전송합니다.forwardMessage메시지를 전달합니다.forwardMessages여러 메시지를 전달합니다.copyMessages여러 메시지를 복사합니다.deleteMessage메시지를 삭제합니다.deleteMessages여러 메시지를 삭제합니다.sendChatAction채팅 액션(typing 등)을 전송합니다.sendMessageDraft메시지 초안(임시 미리보기)을 전송합니다 (Bot API 9.5+).sendContact연락처를 전송합니다.sendLocation위치를 전송합니다.sendVenue장소를 전송합니다.setMessageReaction메시지에 반응을 설정합니다.