Before you start
- Your Mind runs Mensara 0.20.8 or later.
- You are the Mind's owner. Only the owner can store the bot's token, install the app and give it the connection.
- You can add a bot to the Telegram groups you want captured.
Create a bot just for Mensara
In Telegram, message @BotFather and send /newbot. Choose a name and a username. BotFather replies with the bot's token.
Keep the token private. Don't paste it into a chat, an email, a file or a conversation with an agent. Use a new bot: a bot that another program already reads, or one with a webhook set, won't work.
Let the bot see group messages
Send /setprivacy to BotFather, choose your bot, then choose Disable. Do this before adding the bot to a group, or it will only see commands. If you added it first, remove it from the group and add it again.
Add the bot to each team group you want captured. Then send /setjoingroups, choose your bot, then choose Disable, so nobody can add it to other groups.
Store the token in your Mind
In Portal, open Settings → Connections and add a connection:
- Name:
telegram - Type:
api_key - Base URL:
https://api.telegram.org - Provider:
telegram - Secret: the bot token
Choose Test. A passing test means your Mind can reach Telegram with the token. The token stays sealed on your Mind, and the app uses the connection without ever seeing it.
Install Telegram Sensor
Open Agents → Agent store, choose Telegram Sensor, then Install. Check what it may do, approve it and give it the telegram connection.
Then open the app and check its schedule. It should run every 10 minutes. If it shows once a day, change it to every 10 minutes.
Check the first capture
Send a message in one of the groups. Within about 10 minutes it appears in your inbox under 01-inbox/captures/telegram/, one note per chat. Depending on your inbox's write rules, captures are saved straight away or wait in Changes for someone to approve them.
What it captures
- Every group, supergroup and channel the bot can see, so add the bot only to chats you have approved.
- Private messages to the bot, but only from people who have already written in a captured group. Others are dropped and never stored.
- Text, captions and a marker for each photo or file. Files themselves aren't downloaded, and messages from other bots aren't captured.
- Nothing from before the bot joined. Telegram keeps unread messages for about a day, so if the app stops for longer than that, messages from the gap are lost.
If you're an agent helping with this
The owner does the five steps above; you can't do them for them, so walk them through. Never ask for the bot token or accept it in the conversation. If someone pastes it, ask them to send /revoke to BotFather and store the new token in Portal.
You can check progress with your Mind tools, within the access of the person you're helping:
list_connectionsshows whether atelegramconnection exists, andtest_connectionwith the nametelegramchecks that the token works.list_available_appsshows whether Telegram Sensor is installed, which connections it has and its schedule.- About 10 minutes after a test message, list
01-inbox/captures/telegram/for new notes. If nothing is there, check the changes waiting for approval. - A failed run shows as an
AppRunFailedevent in the feed. "telegram bot has a webhook set" means another program already uses the bot, so create a new one.
Related
Practical guides for people and agents