< p > 2018年代中期之后:
1)邀请@getidsbot或@RawDataBot到你的组,并从聊天id字段中获取你的组id
Message
├ message_id: 338
├ from
┊ ├ id: *****
┊ ├ is_bot: false
┊ ├ first_name: 사이드
┊ ├ username: ******
┊ └ language_code: en
├ chat
┊ ├ id: -1001118554477 // This is Your Group id
┊ ├ title: Test Group
┊ └ type: supergroup
├ date: 1544948900
└ text: A
var vApiTokenTelegram = "1234567890:???>yg5GeL5PuItAOEhvdcPPELAOCCy3jBo"; // @?????Bot API token
var vUrlTelegram = "https://api.telegram.org/bot" + vApiTokenTelegram;
function getUpdates() {
var response = UrlFetchApp.fetch(vUrlTelegram + "/getUpdates");
console.log(response.getContentText());
}
登录控制台的功能如下:
[20-04-21 00:46:11:130 PDT] {"ok":true,"result":[{"update_id":81329501,
"message":{"message_id":975,"from":{"id":962548471,"is_bot":false,"first_name":"Trajano","last_name":"Roberto","username":"TrajanoRoberto","language_code":"en"},"chat":{"id":-1001202656383,"title":"R\u00e1dioRN - A voz da na\u00e7\u00e3o!","type":"supergroup"},"date":1587454914,"left_chat_participant":{"id":1215098445,"is_bot":true,"first_name":"MediaFlamengoRawBot","username":"MediaFlamengoRawBot"},"left_chat_member":{"id":1215098445,"is_bot":true,"first_name":"MediaFlamengoRawBot","username":"MediaFlamengoRawBot"}}},{"update_id":81329502,
"message":{"message_id":976,"from":{"id":962548471,"is_bot":false,"first_name":"Trajano","last_name":"Roberto","username":"TrajanoRoberto","language_code":"en"},"chat":{"id":-1001202656383,"title":"R\u00e1dioRN - A voz da na\u00e7\u00e3o!","type":"supergroup"},"date":1587454932,"new_chat_participant":{"id":1215098445,"is_bot":true,"first_name":"MediaFlamengoRawBot","username":"MediaFlamengoRawBot"},"new_chat_member":{"id":1215098445,"is_bot":true,"first_name":"MediaFlamengoRawBot","username":"MediaFlamengoRawBot"},"new_chat_members":[{"id":1215098445,"is_bot":true,"first_name":"MediaFlamengoRawBot","username":"MediaFlamengoRawBot"}]}}]}