DEV Community

Discussion on: Push notifications from server with Telegram Bot API

Collapse
 
fyodorio profile image
Fyodor

Interesting… A couple of questions (if you will of course — sorry in advance if that’s inappropriate):

  1. What kind of identifier this chat id is here?
  2. Is it specific to a chat instance?
  3. Will it be the same if I open my Telegram acc from mobile and desktop?
  4. Is there a way to provide some authorization mechanism with this simple approach? Like if I want to give access to my server’s bot to my peer? Do I need to get the chat id from them as well?
Collapse
 
climentea profile image
Alin Climente • Edited

No worries.

  1. After you create the bot you need to "chat" with it -> a chat_id number will be created between you and the bot;
  2. yes, only between you and the bot -> others who will connect to the bot can't see what the bot sends (tested on 2 phones/accounts);
  3. Yes, same on desktop and mobile on same account;
  4. Yes, the bot token is recommended to be hidden under an apikey you can control (this is what I created for my sites: github.com/ClimenteA/telegram-push...). Not sure about multiple users for the same bot chat conversation. I didn't worked a lot on telegram bots - just enough to create what I needed. Checkout Telegram Channels.

Checkout this project: ntfy.sh/ (can do the same thing better and easier - I have not played with it yet.)

Good luck!