getUserPersonalChatMessages
사용자 개인 채팅의 최근 메시지를 가져옵니다 (Bot API 10.0).
반환값: 성공 시 반환값: Array of Message.
매개변수
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
user_id | Integer | 예 | 사용자 ID |
limit | Integer | 예 | 최대 메시지 수 (1-20) |
요청 예제
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/getUserPersonalChatMessages" \
-H "Content-Type: application/json" \
-d '{"user_id":123456789,"limit":10}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/getUserPersonalChatMessages",
json={
"user_id": 123456789,
"limit": 10
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/getUserPersonalChatMessages`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"user_id": 123456789,
"limit": 10
}),
});
console.log(await res.json());
단계별 가이드: 텔레그램 봇 만들기: @BotFather로 생성하고 첫 메시지 보내기
관련 메서드
getChat채팅 정보를 가져옵니다.getChatMember채팅 멤버 정보를 가져옵니다.getChatMemberCount채팅 멤버 수를 반환합니다.getChatAdministrators채팅 관리자 목록을 반환합니다.setChatTitle채팅 제목을 설정합니다.setChatDescription채팅 설명을 설정합니다.setChatPhoto채팅 사진을 설정합니다.deleteChatPhoto채팅 사진을 삭제합니다.setChatPermissions채팅 권한을 설정합니다.leaveChat채팅에서 나갑니다.exportChatInviteLink채팅의 기본 초대 링크를 새로 발급합니다.createChatInviteLink초대 링크를 생성합니다.