申請BotId


  1. 打開Telegram App, 上方搜尋@botfather, 點@BotFather角色進入 (其餘別亂加)

    Untitled

  2. 如果是第一次使用, 請點下方Start

    Untitled

  3. 輸入/newbot

    Untitled

  4. 隨意輸入Bot名稱, 必須是Bot_Bot結尾

    Untitled

  5. 紅框處就是BotId, 複製起來, 下一步驟會用到

    Untitled

<aside> 💡 如果沒給BotId, 可能是命名問題, 回到步驟4, 確認名稱使用Bot_Bot結尾, 或是換個名稱試試看

</aside>

取得ChatId


  1. 首先需要跟Bot聊天, 點剛剛訊息上t.me/...的連結

    Untitled

  2. 進入聊天視窗, 第一次聊天請點下方Start

    Untitled

  3. 隨便傳幾個訊息給Bot

    Untitled

  4. 打開瀏覽器, 輸入位置: https://api.telegram.org/bot`BotId`/getUpdates

    BotId替換為上一步複製的值

    Untitled

  5. 如果瀏覽器回應內容text是剛剛傳給Bot的訊息, 那前面的id就是ChatId

    Untitled

<aside> 💡 如果仍找不到ChatId, 回到步驟3再嘗試, 並檢查BotId是否複製正確

</aside>