主要為建立機器人Bot
先找BotFather 建立Bot
將Bot 加入群組或是private chat
查找群組chatId or private chat chatId.
Bot會出現在你的列表,先將Bot手動加入群組, bot要發送訊息,需要 chatid 才能知道要發訊息到那邊, 而 chatid 取得方式是用 telegram api 提供的 [ getUpdates ]。
須先在群組裡面標記機器人傳送訊息,再透過抓取機器人聊天訊息Api 取得 chatId。
打開瀏覽器使用 https://api.telegram.org/bot{token}/getUpdatesarrow-up-right ,在回傳的訊息中就可以看到chatid。
透過tg api : sendmessage,測試傳遞訊息,https://api.telegram.org/bot{token}/sendMessage?chat_id={chatid}&text={訊息}arrow-up-right
https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659arrow-up-right
https://dotblogs.com.tw/c5todo/2016/07/10/174049arrow-up-right
https://core.telegram.org/apiarrow-up-right
Last updated 2 years ago