Documentation
Telegram bot
Your own Telegram bot for Recadia - create tasks for agents, notes and memory records by messaging from your phone. Step-by-step setup, commands, autostart and security.
On this page
What you get
You create your own Telegram bot and run a small gateway program. From then on, everything you write or forward to the bot shows up in the Recadia Inbox:
| Send to the bot | What appears in the Inbox |
|---|---|
Call the bank about the card |
A note proposal |
/task Update the CV or task: Update the CV |
A task proposal |
/fact Vacation: I do not work in August or fact: ... |
A memory record proposal |
| A forwarded message | A note marked with who it was forwarded from |
| A photo or file with a caption | A note with the caption and an attachment mark |
The gateway connects to Recadia as an ordinary agent and follows the same rules: agents propose, you accept. Nothing becomes a task, a note or memory without your Accept.
The bot answers briefly: "Saved", "Already saved" or why it was not saved. It answers in the language of your Telegram app (English, Russian or Spanish), or in the one you set with BOT_LANG. Your data from Recadia never goes to Telegram.
Recadia has no built-in bot: the bot is yours, and the gateway runs on your computer or server. No programming needed, only running a command in a terminal (PowerShell on Windows).
What it does not do
- The bot sees only its chat with you. It cannot see your chats with other people or other channels: to save a message, forward it to the bot.
- Messages wait at most a day. While the gateway is off, Telegram keeps messages for the bot up to 24 hours. No "saved" reply means not saved.
- Files are not saved. For photos, documents and voice messages the caption and an attachment mark are saved; the file stays in Telegram. Voice messages are not transcribed.
- The bot does not answer questions or retell your data: it only receives.
Messages to the bot go through Telegram's servers; it is an ordinary cloud chat. Do not send the bot what you would not trust to Telegram.
What you need
- A Recadia account (cloud) or the Recadia desktop app running.
- Node.js 22 or newer. Check:
node --versionin a terminal. If there is no such command, install Node.js LTS from nodejs.org. - A computer or server where the gateway runs. For the cloud, any computer with internet works. For the desktop app, run the gateway on the same computer.
Step 1. Create the bot
- In Telegram open @BotFather (with the blue check mark) and press Start.
- Send
/newbot. - Enter the bot's name, for example
My Recadia. - Enter a short Latin name ending in
bot, for examplejane_recadia_bot. - BotFather sends a token like
1234567890:AAH.... It is the bot's password: never forward it. - Open the new bot from BotFather's message and press Start.
Step 2. Download the gateway
- Create a folder, for example
C:\Recadia\telegram(on Linux/opt/recadia-telegram). - Download gateway.mjs into this folder. It is one file with no dependencies.
- Next to it, create the file
gateway.env(in Notepad) with this content:
TELEGRAM_BOT_TOKEN=PASTE_BOT_TOKEN TELEGRAM_OWNER_ID=PASTE_YOUR_ID RECADIA_URL=https://recadia.timeuslab.com RECADIA_AGENT_KEY=PASTE_AGENT_KEY NOTES_FOLDER=Telegram TASK_LIST= BOT_LANG=auto
- Paste the token from step 1 after
TELEGRAM_BOT_TOKEN=with no spaces or quotes.
gateway.env is the only place that holds the token and the key. Do not put this folder in git, a shared cloud drive or a chat.
Step 3. Find your Telegram ID
The bot accepts messages only from you, so it needs your numeric ID.
- Send your bot any message, for example
hello. - In a terminal, in the gateway folder, run:
cd C:\Recadia\telegram node gateway.mjs --whoami
- The program shows a line like
TELEGRAM_OWNER_ID=123456789 (Jane). Put the number intogateway.env.
--whoami saves nothing and does not consume messages.
Step 4. Issue an agent key in Recadia
The gateway signs in to Recadia as a separate agent. That way the Inbox shows the record came from Telegram, and you can revoke the gateway's access without touching other agents.
- Open Recadia, My AI.
- In the New agent block: name
Telegram, client Other. Press Add agent. - Open the
Telegramagent, press Issue key and copy it. The key starts withroma_and is shown once. - Paste the key into
gateway.envafterRECADIA_AGENT_KEY=. - Check
RECADIA_URL: the address you open Recadia at, without/mcpat the end. In the cloud it ishttps://recadia.timeuslab.com, in the desktop apphttp://127.0.0.1:4317. - To send tasks to a particular list, put its name into
TASK_LIST=. Empty means the first list the gateway sees. The list must already exist in Tasks. BOT_LANG=autoanswers in the language of your Telegram app. Puten,ruoresto fix the language of the replies and of the lines the gateway adds to records ("From Telegram", "Forwarded from").
If you set the gateway up earlier with MINDKEEP_URL and MINDKEEP_AGENT_KEY, it keeps working: these older names are still read.
Step 5. Check and start
node gateway.mjs --check
You should see three OK lines: for the bot, for the Telegram agent and for the task list. If something is wrong, the program says what (see Common errors). Then start the gateway:
node gateway.mjs
While the terminal window is open, the gateway works. Stop it with Ctrl+C.
Test: send the bot Gateway test. In a couple of seconds the bot replies, and a note proposal from the Telegram agent appears in the Inbox. Press Accept, and the note appears in Notes, in the Telegram folder.
Setting tasks from Telegram
The first line after /task is the task title, the other lines are the description. To suggest who should do it, add a separate line For: agent name:
/task Fix the sign-in form on the site For: Claude Code The Sign in button does not work on the phone.
A task proposal appears in the Inbox. Who does it is already filled with this agent if you have exactly one agent with that name. If there is none, the hint shows as text and you choose the agent yourself. The task goes to the agent only after your Accept, and you can change the field before that.
Then the agent gets the task as usual: at the start of a session, when you ask, or on a schedule. Details: Tasks for agents.
All bot commands
| Send | Result |
|---|---|
| Plain text | A note: the first line is the title, the whole text is the content |
/task text or task: text |
A task; the line For: name suggests who does it |
/fact subject: statement or fact: ... |
A memory record. Without a colon the subject is "Telegram" |
/note text or note: text |
Explicitly a note, when the text itself starts with "task:" |
/help or /start |
The bot repeats the rules |
Your own words go to memory as Confirmed, forwarded ones as Assumption. If memory is off for the Telegram agent in My AI, the bot says so and saves nothing.
One message, one record. The gateway passes the Telegram message number, and the server never creates a second record for the same message, even after a gateway restart. The bot answers "already saved".
Duplicates. The server does not let anything be proposed twice: a task is checked against open tasks of the same list and the Inbox, a memory record against memory and the Inbox, a note against the Inbox and notes in the same folder with the same text.
Autostart
Windows: Task Scheduler
Run in PowerShell with your folder:
$dir = "C:\Recadia\telegram" $action = New-ScheduledTaskAction -Execute (Get-Command node).Source -Argument "`"$dir\gateway.mjs`"" -WorkingDirectory $dir $trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME $settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero) -RestartCount 999 -RestartInterval (New-TimeSpan -Minutes 1) -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries Register-ScheduledTask -TaskName "Recadia Telegram" -Action $action -Trigger $trigger -Settings $settings
The gateway now starts when you sign in to Windows.
- Start now:
Start-ScheduledTask -TaskName "Recadia Telegram" - Stop:
Stop-ScheduledTask -TaskName "Recadia Telegram" - Remove autostart:
Unregister-ScheduledTask -TaskName "Recadia Telegram" -Confirm:$false
Linux: systemd
- Put
gateway.mjsandgateway.envinto/opt/recadia-telegramand close the settings file to others:
sudo chown -R $USER /opt/recadia-telegram chmod 600 /opt/recadia-telegram/gateway.env
- Create the service file
/etc/systemd/system/recadia-telegram.service(put your user instead ofjane; check the Node path withwhich node):
[Unit] Description=Recadia Telegram gateway After=network-online.target Wants=network-online.target [Service] User=jane WorkingDirectory=/opt/recadia-telegram ExecStart=/usr/bin/node /opt/recadia-telegram/gateway.mjs Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
- Enable and start it:
sudo systemctl daemon-reload sudo systemctl enable --now recadia-telegram journalctl -u recadia-telegram -f
If Recadia is not reachable, the gateway waits and retries by itself; messages are not lost within a day.
Without downloading: ask your agent
An agent that works with files and a terminal (Claude Code, Codex, opencode) can set up the gateway itself. Create the bot (step 1), issue the key (step 4) and send the agent the text below. Do not write the token or the key in the chat: you put them in the file yourself.
Set up a Telegram gateway to Recadia by following https://recadia.timeuslab.com/docs/telegram-bot/. 1. Folder C:\Recadia\telegram. Download gateway.mjs from https://recadia.timeuslab.com/_site/telegram/gateway.mjs into it and create gateway.env from the sample in the instructions. 2. Do not ask me for the bot token or the agent key in the chat, do not print them and do not put them in git: I will put them into gateway.env myself. 3. Help me find my TELEGRAM_OWNER_ID with node gateway.mjs --whoami. 4. Check the settings with node gateway.mjs --check and tell me what to fix. Do not set up any autostart without my OK.
Security
- Only you. The gateway accepts messages only from your private chat with the bot, from
TELEGRAM_OWNER_ID. Messages from anyone else and from groups are skipped silently. Even if someone finds your bot, they cannot save anything. - Secrets in one file. The bot token and the agent key live only in
gateway.env. The gateway never prints them, even in errors. - The gateway key is an agent key. It gives only the rights of the
Telegramagent: propose, and read what this agent sees. The gateway does not need the owner key.
How to turn it off, from soft to complete:
- Stop the gateway:
Ctrl+C, or stop the autostart task. - Revoke the key: My AI - the
Telegramagent - Revoke key. The gateway stops saving at once. - Change the bot token: @BotFather -
/mybots- your bot - API Token - Revoke current token. - Delete the bot: @BotFather -
/deletebot.
If you think someone saw gateway.env, do steps 2 and 3 and issue a new key.
Common errors
| What you see | What to do |
|---|---|
Settings file not found |
There is no gateway.env in the gateway folder |
Setting ... is empty |
This line in gateway.env is not filled in |
Telegram refused the bot token |
The token is wrong or revoked: copy it again in @BotFather (/mybots, API Token) |
Another copy of the gateway (or a webhook) uses this bot |
The gateway runs twice; keep one copy. If the bot was used in another program, remove its webhook: open api.telegram.org/bot<token>/deleteWebhook in a browser |
... is not reachable |
Recadia is not running or RECADIA_URL is wrong. The gateway retries by itself |
| The bot says the key does not fit or was revoked | Issue a new key for the Telegram agent and replace it in gateway.env |
| The bot says there is no task list | Create a list in Tasks or fix TASK_LIST (exact name) |
| The bot says memory is off | Turn memory on for the Telegram agent in My AI |
| The bot is silent | The gateway is not running, the message is not from TELEGRAM_OWNER_ID (check --whoami), or you write in a group |
--whoami: No messages yet |
Message the bot first, then try again |
Gateway commands: node gateway.mjs - run, --check - check the settings, --whoami - find your ID, --once - process what is waiting and exit, --config path - another settings file.