Operating manual
Shared modulesVerified 2026-11-1112 min read

Telegram for executives

Connect a Telegram bot so executives can query the assistant, pull reports and approve transactions from a phone. Document uploads happen in the web app.

ForAdministratorExecutive
LaneAll lanes

What this enables

Telegram is a phone-side console for four jobs only. It does not take document or photo uploads.

JobWhat you do
NotificationsApproval and alert pushes arrive as Telegram messages.
ApprovalsApprove or reject an AI task you are authorized for, with a YES/NO confirmation that expires after 15 minutes.
QuestionsAsk in plain English — counts, balances, status — and get a chat answer.
ReportsAsk for a report and receive it as an Excel, PDF, CSV or TSV file, or ask for "text" to get a plain chat answer instead.

Rule

Uploads are web-only

PDF, image and Excel ingestion happens in the web app — Procurement → Bill intake or the relevant module. The bot replies with a pointer and ingests nothing.

There are two parts. Part A is a one-time technical setup done by whoever has server access. Part B is done by the CEO in the web app.

Part A — one-time technical setup (administrator)

Watch

Administrator only

This part needs access to environment variables and the deployed URL. If you are a CEO or CFO, skip to Part B — your administrator completes Part A.

  1. A1

    Create the Telegram bot

    Open Telegram, start a chat with @BotFather and send /newbot. Give the bot a display name and a username ending in bot. BotFather replies with a bot token — treat it like a password.

  2. A2

    Add the environment variables

    Set TELEGRAM_BOT_TOKEN to the token. Set TELEGRAM_WEBHOOK_SECRET to a long random string — this signs every webhook request and, if it is missing, the webhook refuses all requests (fail-closed). Also set NEXT_PUBLIC_SITE_URL to the app's absolute public URL, which the setup call uses to derive the webhook target.

  3. A3

    Deploy the app

    The webhook route lives at /api/telegram/webhook. Deploy to production and confirm NEXT_PUBLIC_SITE_URL matches the public URL; for local testing expose a tunnel to your machine.

  4. A4

    Register the webhook

    Send an authenticated PUT to the webhook route with the header Authorization: Bearer <secret>. The secret is TELEGRAM_WEBHOOK_SETUP_SECRET when set, otherwise TELEGRAM_WEBHOOK_SECRET. The server derives the target from NEXT_PUBLIC_SITE_URL, registers it with Telegram and installs the command menu. The expected response is {"ok": true, "url": "…", "commands": true}. The webhook URL cannot be set with a GET query parameter.

  5. A5

    Verify it is live

    Open the route with only the secret parameter: GET /api/telegram/webhook?secret=YOUR_WEBHOOK_SECRET. The response shows the webhook info and command registration. The info should show your webhook url and pending_update_count 0. If last_error_message appears, the URL is not reachable — fix that first.

Note

Once is enough

You will not need to repeat Part A unless the bot token or the webhook URL changes.

Part B — the CEO maps the chats

  1. B1

    Ask each executive for their chat ID

    Send them these steps: open Telegram, search for your bot, press Start or send /start, and the bot replies with a numeric chat ID to send back to you. If no reply arrives, @userinfobot replies with the numeric ID.

  2. B2

    Open Telegram Setup

    Sign in as CEO and open Settings → Telegram Setup. The page is restricted to the CEO and platform SuperAdmins; other roles are redirected away.

    Administration → Telegram/dashboard/admin/settings/telegram
  3. B3

    Map each chat ID

    For each executive, select their name in Member, paste the chat ID in Telegram chat ID and click Map chat. The page confirms 'Chat ID mapped. The member can now use the bot.', and the mapping appears under Active mappings with status Linked.

  4. B4

    Verify access

    Ask each executive to send a message and confirm the bot responds — for example a cash-position question, /org, or an approval request. Do not expect file uploads here; documents are uploaded in the web app.

  5. B5

    Remove a mapping when needed

    In Active mappings, click the trash icon next to a member. The bot immediately stops accepting messages from that chat.

Rule

Chat IDs are the allowlist

A chat ID can be mapped to only one member, cannot be mapped to someone outside your workspace, and unmapped chats are ignored by the bot and reach no data. Approvals that need no entity selection run the exact same transaction as web approvals; invoice, sales-order, purchase-order and payment-receipt approvals stay on web so a human chooses the payer or payee. Telegram approvals post one journal entry and one audit entry.

Who can approve what on Telegram

Task typeApproves (AI authority)On Telegram
Sales invoiceCEO, CFOWeb card only — needs a customer; reject still available
Sales orderCEO, CFOWeb card only — needs a customer; reject still available
Payment receiptCEO, CFOWeb card only — needs the invoice being paid; reject still available
Purchase orderCEO, CFO, COO ≤ thresholdWeb card only — needs a vendor; reject still available
Expense receiptCEO, CFO, COO ≤ thresholdApprove or reject here
Customs declarationCEO, CFO, COO ≤ thresholdApprove or reject here
WaybillCEO, CFO, COO (uncapped)Approve or reject here
Bill of ladingCEO, CFO, COO (uncapped)Approve or reject here
Demurrage statementCEO, CFOApprove or reject here

Rule

Sales Manager: no AI approvals on Telegram

SALES_MANAGER can use Telegram for notifications, questions and reports, but does not approve AI tasks in the chat. Customer invoicing and orders and procurement bills are approved in the web modules.

Rule

Entity-gated approvals need the web card

Invoice, sales order, purchase order and payment receipt each need a human-selected customer, vendor or invoice. On Telegram the bot shows guidance and offers Reject only; Approve happens in the web approval card at /dashboard/approvals.

The COO's monetary approvals are capped by the organization's base-currency threshold (inclusive). Above the threshold, or when no threshold is configured, the task escalates to the CEO — a state change, never an auto-approval. Every approval still commits through the same approval core as the web, with no change to posting logic.

Verifying each executive's access

TestExpected reply
Send 'what is our cash position?'A cash summary covering bank, petty cash, receivables and payables
Send 'how many invoices are pending today'A plain-English count of pending invoices
Send 'bill payments pending'A plain-English count of pending bill payments
Send /orgOrganization ID and your role
Ask for a report as Excel or PDF, e.g. 'P&L for last month, Excel'The report arrives as an Excel or PDF file
Ask for 'text', 'summary' or 'no file'A plain chat answer (not a .txt file); if no text answer exists, a file is sent
Ask to approve an eligible taskThe match and a YES/NO prompt; a second confirmation message commits it
Ask to approve an invoice, sales order, purchase order or payment receiptGuidance to the web approval card; reject remains available
Sales Manager asks to approve any AI taskA message that AI approvals are handled in the web app
Send /cancelCancels the live YES/NO confirmation

Executive command reference

CommandWhat it does
/startShows help; before mapping, replies with your chat ID
/helpShows help
/approvalsLists tasks awaiting your approval
/reportsExplains how to request a report (file or text)
/orgShows your organisation and role
/settingsPoints to Settings → Telegram in the web app
/cancelCancels the current YES/NO confirmation
Plain textAsk anything in plain English — counts, cash, inventory, sales, trips — or request a report
Document or photoNot accepted in Telegram — upload in the web app (Procurement → Bill intake or the relevant module)

Troubleshooting

SymptomCause and fix
Bot does not reply to /start during setupWebhook not registered or URL unreachable — redo steps A4 and A5
Webhook shows last_error_messageThe URL must be HTTPS and publicly reachable — check the deployment or tunnel
TELEGRAM_BOT_TOKEN is not configuredThe environment variable is missing in the environment the app runs in
This chat ID is already mapped to a memberThe ID is bound to someone else — ask for the exact number the bot replied with
Executive gets no reply after mappingConfirm the mapping exists, the member is active, and the chat is private rather than a group
Duplicate messages when asking a questionExpected safety net — the system deduplicates on Telegram's message ID
Executive sends a PDF or image in TelegramThe bot replies with a web-app pointer and ingests nothing — upload it in the web app (Procurement → Bill intake or the relevant module)
Executive expects to approve an invoice, PO, sales order or payment receiptThose are entity-gated and approve only in the web card at /dashboard/approvals — Telegram offers reject only
Sales Manager sees no approvalsExpected — SALES_MANAGER has no AI approval authority; their invoice, order and bill approvals happen in the web modules