Creating your Bot
- First you have to open a chat with @BotFather by klicking this link.
- Now send him
/newbot
- Give him a display-name for your new bot
- Give him a identifyer for your new bot (This should look like
<name>bot
)
- The BotFather sends you a link to start a chat with your bot and the api-token to access the new bot. Please note down the api-token at a safe place!
Getting the Chat-ID
- Open the link to your Bot
- Send
/start
to your Bot - Open up
https://api.telegram.org/bot<api_token>/getUpdates
- Every message comes with an
id
-field. This id is the chat-id!
Now we have everything to get started with sending messages.
Easy Scripts to get started
Here are some easy scripts that I personaly use for cron-status-messages. You should replace <api_token>
and <chat_id>
with your own values.
telegram_message.sh
|
|
Send a text-message to your chat-id via ./telegram_message.sh <your_message>
telegram_file.sh
|
|
Send a file to your chat-id via ./telegram_message.sh <path_to_file>