I’m trying to use Github Actions to send a Telegram message every time someone pushes to the master of repo. But using this action causes the following error and action fails:
missing telegram token or user list
Here is my yml file:
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Telegram Notify
uses: appleboy/[email protected]
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
An event occured in ${{ github.repository }} repository.
${{ github.event_name }}
I quite new in Github Actions. What should I do to fix this?
P.S: I’ve added telegram_token and telegram_chat_id to secrets section of repo.
2
Answers
Go to the repo settings and set the secrets for the TELEGRAM_CHAT_ID and the TELEGRAM_TOKEN. when setting the secrets for TELEGRAM_TOKEN make sure to send the queries to the Telegram Bot API using the bot token https://api.telegram.org/bot/METHOD_NAME, for example https://api.telegram.org/bot19023205:BNF-23dred1234ghIkl-dre4fdgr8nv1w4od/getMe
Just in case, who got error "missing telegram token or user list" on "appleboy/telegram-action" when using reusability workflow (or workflow_call), may this help.
If you are using workflow reusability to use send telegram notif,
for example:
secrets wont get passed directly to here!
you need to pass it on your caller like this
Hence, on your workflow_call will use the secrets provided by the caller.
I hope somene who stumble on the same problem