Closed hpuac closed 3 years ago
My setup matches yours. For me everything is working like a charm. What I did to make it work.
TELEGRAM_BOT_TOKEN
and TELEGRAM_CHAT_ID
. Please keep in mind that you might need single ticks '
instead of double ticks "
for the export.
export TELEGRAM_BOT_TOKEN='MySuperSecretToken:asdasdsad'
export TELEGRAM_CHAT_ID='MyChatId'
python3 -m unittest tests.notifier.test_telegram_notifier
If you debug and get and HTTP 400 response you need to double check your env varibales, espacially your TELEGRAM_CHAT_ID.
You can also send a message with the following command to try it out
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "${TELEGRAM_CHAT_ID}", "text": "This is a test from curl", "disable_notification": true}' \
https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage
Also keep in mind that you need to start the bot. You will find out all opened chats of your bot by calling https://api.telegram.org/$TELEGRAM_BOT_TOKEN/getUpdates
. Simply result->INDEX->...CHAT->ID
Hopefully this will be helpful
Also keep in mind that you need to start the bot.
@St3ffn That was the missing piece, I feel so dumb now! Thx a lot! So for anyone running into the same problem: After creating the bot with BotFather you have to click on it (t.me/your_bot link in the BotFather message) and then start it :sweat_smile:
Describe the bug
Hey folks, I created a telegram bot and got my chat ID but when I try to run the unit tests I get the following output:
Do you have any idea what went wrong? The bot token and chat ID was copy pasted so it can't be a typo. And the regular tests (
python3 -m unittest
) are passing.Environment: