To be able to use this script, please follow the steps below. If something is unclear, don't hesitate to add a comment below.
Request a bot token to the @Botfather Start a direct conversation and follow the steps described.
Once the new bot is created search for the sentence "Use this token to access the HTTP API:" This token will be the $BOT_TOKEN variable in the script.
Either start a discussion with @RawDataBot or add him to a group.
and type /start
.
You will then receive something like
{
"update_id": 123456,
"message": {
"message_id": 123456,
"from": {
"id": 123456,
"is_bot": false,
"first_name": "YOUR_NAME",
"username": "YOUR_USERNAME",
"language_code": "XX"
},
"chat": {
"id": YYYYYYYYY,
"first_name": "YOUR_NAME",
"username": "YOUR_USERNAME",
"type": "private"
},
"date": 123456,
"text": "/start",
"entities": [
{
"offset": 0,
"length": 6,
"type": "bot_command"
}
]
}
}
The "YYYYYYYYY" value will be the $CHAT_ID in the script.
Access your build within Travis CI, go to Settings
/ Environment Variables
and add the "BOT_TOKEN" and "CHAT_ID".
Don't forget to leave "Display value in build log" unchecked otherwise you'll publish your secret onto your build.
Or consult this page of documentation.
Edit your .travis.yml
file to add the following lines to deploy:
. Don't forget to adapt the settings if needed, for example "YOUR_BRANCH".
- provider: script
script: bash notify.sh)"
on:
branch: YOUR_BRANCH
The file can be found here
A) Follow the Steps 1 and 2 from the previous setup to get the token and id.
B) Create the telegram-login-notifier.sh
file in /opt/
C) Exchange the values in the telegram-login-notifier.sh
script (XXXXXXX and YYYYYYY).
D) Add the following line in the /etc/profile
: ./telegram-login-notifier.sh