mirror of
https://github.com/caronc/apprise.git
synced 2024-12-12 09:51:05 +01:00
Updated Notify_telegram (markdown)
parent
f5a806a4be
commit
08a1b45117
@ -7,32 +7,41 @@
|
||||
### Account Setup
|
||||
Telegram is slightly more complicated then some of the other notification services, so here is quick breakdown of what you need to know and do in order to send Notifications through it using this tool
|
||||
|
||||
At the very start, you will need to connect with a phone. The site uses your phone number as it's credential to let you into your account. So download and install the phone app first via [Android](https://telegram.org/dl/android) or [Apple](https://telegram.org/dl/ios).
|
||||
At the very start (if you don't have an account already), you will need to connect with a phone. The site uses your phone number as it's credential to let you into your account. So download and install the phone app first via [Android](https://telegram.org/dl/android) or [Apple](https://telegram.org/dl/ios).
|
||||
|
||||
Once you're set up, it can be a bit easy to just use their web interface [here](https://telegram.org/dl/webogram) with a PC (especially for development); but this part is up to you.
|
||||
|
||||
Telegram notifications require you need to first access https://api.telegram.org and create a bot. After creating the bot, you will need to acquire it's Token Identifier (*bot_token*).
|
||||
#### Bot Setup
|
||||
Telegram notifications require you to [create a bot](https://api.telegram.org). It's only after this is done that you will gain a vital piece of information Apprise needs called the **Token Identifier** (or **bot_token**).
|
||||
|
||||
To do this you will be required in a chat with the **[BotFather](https://botsfortelegram.com/project/the-bot-father/)** to type: ```/newbot```. Answer the questions it asks after doing this (which get the name of it, etc). When you've completed this step, you will be provided an *bot_token* that looks something like this: ```123456789:alphanumeric_characters```.
|
||||
To do this you will have to open a communication (inside Telegram) to the **[BotFather](https://botsfortelegram.com/project/the-bot-father/)**. He is available to all users signed up to the platform. Once you've got a dialog box open to him:
|
||||
1. Type: ```/newbot```
|
||||
2. Answer the questions it asks after doing this (which get the name of it, etc).
|
||||
3. When you've completed step 2, you will be provided a *bot_token* that looks something like this: ```123456789:alphanumeric_characters```.
|
||||
4. Type ```/start``` now in the same dialog box to enable and instantiate your brand new bot.
|
||||
|
||||
You will need to ```/start``` the bot to get it going for good. To make your life easier, it would be a good idea to send a message to this new bot you created. The content of your message can be anything; but it will ease the use of this script for you.
|
||||
The good news is this process only has to be done once. Once you get your **bot_token**, hold on to it and no longer worry about having to repeat this process again. It's through this bot that Apprise is able to send notifications onto Telegram to different users.
|
||||
|
||||
#### Chat ID Conundrum
|
||||
|
||||
Behind the scenes, Telegram notifies users by their **{chat_id}** and not their _easy-to-remember_ user name.
|
||||
Unfortunately (at this time) Telegram doesn't make it easy to get this information.
|
||||
|
||||
To make your life easier, it would be a good idea to send a private message to this new bot you just created. This allows apprise to detect _your_ **{chat_id}** automatically since it can be easily pulled from the message you sent. It also makes it so you just need to use the simple apprise URL:
|
||||
* **tgram**://**{bot_token}**/
|
||||
|
||||
This part is entirely optional; but worth considering!
|
||||
|
||||
### Syntax
|
||||
Valid are as follows:
|
||||
* **tgram**://**{bot_token}**/
|
||||
* Note: apprise is clever enough to determine the chat_id of the bot owner (you) only if you've sent it at least 1 private message first. It doesn't matter what you write to it; but just any message allows your chat_id to be detectable. If the chat_id can't be detected, then this URL will not work.
|
||||
* **Note**: As already identified above: Apprise is clever enough to determine the chat_id of the bot owner (you) _only if you've sent it at least 1 private message to it_ first.
|
||||
|
||||
* **tgram**://**{bot_token}**/**{chat_id}**/
|
||||
* **tgram**://**{bot_token}**/**{chat_id1}**/**{chat_id2}**/**{chat_id3}**/
|
||||
|
||||
This can also be written like so:
|
||||
* **tgram**://**{chat_id}**@**{bot_token}**/
|
||||
|
||||
If you don't know the chat_id, this script will attempt to detect the one belonging to the bot owner (which is usually you). So this is a valid URL as well:
|
||||
* **tgram**://**{bot_token}**/
|
||||
|
||||
**Note:** Please note that there is no guarantee that this script will always be able to determine who the bot owner is (in most cases it will though). When the bot owner is detected, it's **{chat_id}** is presented in the logs. Ideally you should ideally take this and update your URL to explicitly reference this in the future.
|
||||
|
||||
**Note:** When using the short form of the Apprise URL and the bot owner (probably you) is detected, it's **{chat_id}** is presented in the logs. Ideally you should ideally take this and update your URL to explicitly reference this in the future.
|
||||
|
||||
If you want to see the icon/image associated with the notification, you can have it come through by adding a **?image=yes** to your URL string like so:
|
||||
* **tgram**://**{bot_token}**/**?image=Yes**
|
||||
@ -51,6 +60,6 @@ If you want to see the icon/image associated with the notification, you can have
|
||||
Send a telegram notification to lead2gold:
|
||||
```bash
|
||||
# Assuming our {bot_token} is 123456789:abcdefg_hijklmnop
|
||||
# Assuming our {chat_id} is 12315544
|
||||
# Assuming the {chat_id} belonging to lead2gold is 12315544
|
||||
apprise tgram:///123456789:abcdefg_hijklmnop/12315544/
|
||||
```
|
Loading…
Reference in New Issue
Block a user