Skip to content

Instantly share code, notes, and snippets.

@lockevn
Last active August 2, 2022 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lockevn/f0c9f82810a0fac5dabb94d5bb30ee12 to your computer and use it in GitHub Desktop.
Save lockevn/f0c9f82810a0fac5dabb94d5bb30ee12 to your computer and use it in GitHub Desktop.
Sample message send from Telegram to bot webhook
/**
message format,
update_id is the data-mid when we inspect the web.telegram.org message
message.message_id is the number when we use mouse to copy link to specific message
*/
// bot can receive this
const sampleAdminPostToChannel = {
update_id: 72955,
channel_post: {
message_id: 23,
sender_chat: {
id: -10010224,
title: "Gurucore Test Channel",
username: "thuan",
type: "channel"
},
chat: {
id: -100100224,
title: "Gurucore Test Channel",
username: "thuan",
type: "channel"
},
date: 1628942262,
text: "Strong test"
}
}
/**
in case a message from a linked Channel is forward to to linked group by Telegram
from: { id: 777000, is_bot: false, first_name: "Telegram" }
forward_from_chat and sender_chat are the linked channel
chat is the group (which display this message)
*/
const sampleMessageFromLockevnToXCapitalVietnamGroup = {
update_id: 665463,
message: {
message_id: 16517,
from: {
id: 228129,
is_bot: false,
first_name: "Lockevn",
language_code: "en"
},
chat: {
id: -10038688,
title: "XCapital Vietnam",
type: "supergroup"
},
date: 1628841207,
text: "trần?"
}
}
const sampleNewChatMember = {
update_id: 128964,
message: {
message_id: 29,
from: {
id: 17564,
is_bot: false,
first_name: "Ngoc",
last_name: "Ngoc"
},
chat: {
id: -1001233,
title: "Metacity-Art pool VN",
type: "supergroup"
},
date: 165957,
new_chat_participant: {
id: 175614,
is_bot: false,
first_name: "Ngoc",
last_name: "Ngoc"
},
new_chat_member: {
id: 175614,
is_bot: false,
first_name: "Ngoc",
last_name: "Ngoc"
},
new_chat_members: [
{
id: 175914,
is_bot: false,
first_name: "Ngoc",
last_name: "Ngoc"
}
]
}
}
const sampleLeftChatMember = {
update_id: 128962,
message: {
message_id: 27,
from: {
id: 149894,
is_bot: false,
first_name: "Linh",
last_name: "Do"
},
chat: {
id: -1001233,
title: "Metacity-Art pool VN",
type: "supergroup"
},
date: 1659069378,
left_chat_member: {
id: 149194,
is_bot: false,
first_name: "Linh",
last_name: "Do"
}
}
}
const sampleNormalUserSendToGroup = {
update_id: 646973827,
message: {
message_id: 16534,
from: {
id: 5965,
is_bot: false,
first_name: "Ánh",
last_name: "Nguyễn Ngọc"
},
chat: {
id: -1001688,
title: "XCapital Vietnam",
type: "supergroup"
},
date: 1628850916,
text: "tt rug lăc là bot bao thôi ❤️"
}
}
const sampleFromUserSendToBot = {
update_id: 643831,
message: {
message_id: 20518,
from: {
id: 17914,
is_bot: false,
first_name: "Ngoc",
last_name: "Ngoc",
language_code: "en"
},
chat: {
id: 17914,
first_name: "Ngoc",
last_name: "Ngoc",
type: "private"
},
date: 11288,
text: "Hello from Ngọc"
}
}
const sampleUserReplyToUserInDM = {
update_id: 64852,
message: {
message_id: 209,
from: {
id: 22829,
is_bot: false,
first_name: "Lockevn",
language_code: "en"
},
chat: {
id: 2229,
first_name: "Lockevn",
type: "private"
},
date: 1621786,
reply_to_message: {
message_id: 20452,
from: {
id: 167386,
is_bot: true,
first_name: "Celiné"
},
chat: {
id: 2229,
first_name: "Lockevn",
type: "private"
},
date: 1628841494,
text: "#MIG ≈ 0.81 tỷ 14:57:36\n40,000 cp\n20.2 -3.81% 🟥 \n\n#TVB ≈ 0.69 tỷ 14:54:57\n40,000 cp\n17.2 0% tham chiếu \n\n#TVB ≈ 0.86 tỷ 14:54:55\n50,000 cp\n17.2 0% tham chiếu",
entities: [
{
offset: 0,
length: 4,
type: "hashtag"
},
{
offset: 0,
length: 4,
type: "bold"
}
]
},
text: "thật không?"
}
}
const sampleMessageFromLinkedChannelToGroup = {
update_id: 64821,
message: {
message_id: 14,
from: { id: 777000, is_bot: false, first_name: "Telegram" },
sender_chat: {
id: -100124,
title: "Thoả thuận channel",
type: "channel"
},
/**
* Context where bot has this message from
*/
chat: {
id: -1001690,
title: "XCapital - giao dịch thoả thuận",
type: "supergroup"
},
date: 1628849438,
forward_from_chat: {
id: -100224,
title: "Thoả thuận channel",
type: "channel"
},
forward_from_message_id: 2,
forward_date: 1628849435,
text: "Send from channel PT to Group PT"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment