Im using Thingsboard to send alarms to a telegram bot. I have created the bot, with its name and username, I have the TOKEN, and I have the chat id to send updates to the bot.
Now I, as a telegram user, can see the alarms I send to this bot, and tried using the HTML api simulator using the token and chat-id.
How are the next steps now to allow other users to see the bot updates? Because I sent the bot URL and the bot name (both ways) to a friend to access it, he typed /start, and after that time he should have seen another test update I had sent, but he saw nothing….
I’m new to telegram so any help would be appreciated…
Thanks
1
Your question is a bit vague, but I’ll try to explain from what I understood.
All Telegram Bots will have a designated username to it, for example @MyIDBot
, this username can be used to send the bot to your friends or anyone. The username can also be used as a link like this: https://t.me/MyIDBot
to share the bot.
When a user interacts with your bot such as sending /start
command or sends a message, your bot will receive an update from Telegram Bot API server. The Bot TOKEN
is used to interact with the Bot API Server. So to get the pending updates you can use the /getUpdates method. You can code your bot to process the updates and to respond to incoming messages.
This is the basics.
On your case (from your question, and the comment), I can see with your code you’re sending the alarms from ThingsBoard to a group. I’m assuming you haven’t coded your bot to respond to individual users as said previously. Now your bot works just as a broadcaster only sending updates to a group. So if your friends also need to see the updates, they should join in the group where the updates are posted. They will not receive messages from your bot as direct messages.
If you want your bot to send new updates to users individually, you code your bot to save their chat_id
in your database when the user sends /start
(this will be the first update your bot gets from an individual user). Once you have their chat_id
just like you send message to the group, use the user’s chat_id to send them update message using /sendMessage.
Hope this helps 🙂
1