AGENT SKILL

telegram-bot

Send messages, photos and files to Telegram through the user's own bot, using a bot token held by the DIME credential proxy. Covers finding the chats the bot can reach, posting to a private chat, group or channel, editing and deleting what it sent, and sending from a data feed. Use for ANY request to message, notify or alert the user on Telegram, "send this to my Telegram", "post alerts to my channel", or a 403 from the credential proxy on api.telegram.org.

License 许可
MIT
最近更新
2026-11-13
Stars
★ 0
Forks
0

01 前言 Front Matter

name
telegram-bot
metadata
{ "author": "tradeparadigm" }
description
Send messages, photos and files to Telegram through the user's own bot, using a bot token held by the DIME credential proxy. Covers finding the chats the bot can reach, posting to a private chat, group or channel, editing and deleting what it sent, and sending from a data feed. Use for ANY request to message, notify or alert the user on Telegram, "send this to my Telegram", "post alerts to my channel", or a 403 from the credential proxy on api.telegram.org.

02 资源文件 1

03 SKILL.md 正文

Telegram

Your AGENTS.md already explains the placeholder mechanism in general. This file covers only what is specific to Telegram.

What you hold

One bot token, as CRED_TELEGRAM_API_BOT. The name depends on what the user picked at enrolment, and the script takes any CRED_TELEGRAM… variable.

The token belongs in the URL path, https://api.telegram.org/bot<token>/<method>. Use the script beside this file. It puts the placeholder there for you.

Only one bot works at a time. A second Telegram credential makes every request from both fail. If env | grep '^CRED_TELEGRAM' lists two, tell the user to revoke one in Settings → Credentials.

Finding a chat

A bot cannot start a conversation. The user has to reach it first:

  • A private chat: the user opens their bot in Telegram and sends it any message.
  • A group: the user adds the bot to the group and sends a message there.
  • A channel: the user adds the bot as an administrator with permission to post.

Then:

node scripts/telegram.mjs me      # the bot's @username, to tell the user who to message
node scripts/telegram.mjs chats   # every chat that has reached the bot recently

chats reads Telegram's pending updates, which it keeps for 24 hours. If the chat is not listed, ask the user to send the bot another message. A public channel also works by its @name as the chat id.

Write the chat id down where you will find it again, such as the data feed's config. Ask the user which chat to use when there is more than one.

Sending

node scripts/telegram.mjs send --chat 123456789 --text "BTC crossed 100k"
echo "multi-line text" | node scripts/telegram.mjs send --chat -1001234567890
node scripts/telegram.mjs send --chat @mychannel --html --text "<b>Fill</b> 2 BTC @ 99,950"
node scripts/telegram.mjs photo --chat 123456789 --file chart.png --caption "BTC 1h"
node scripts/telegram.mjs document --chat 123456789 --file report.csv

Give the script's absolute path when you run it from another directory. Each command prints Telegram's answer as JSON: send prints the message ids, and edit and delete take one with --message.

  • Text is plain unless you pass --html. With --html, escape <, > and & in anything you did not write, or Telegram refuses the message.
  • --silent delivers without a notification sound.
  • Plain text over 4096 characters is split into several messages, at a line break where there is one. --html text over 4096 characters is refused: split it yourself, keeping each tag inside one message.

From a data feed

The folder holding this file is replaced when the app updates, so copy the script into the data feed's own directory:

cp <this folder>/scripts/telegram.mjs ~/.openclaw/workspace/datafeeds/<name>/

Then import it in datafeed.mjs and call sendMessage:

import { sendMessage } from './telegram.mjs';

await sendMessage(chatId, text, { cred: config.telegramCred });

Store the placeholder's value in the data feed's config as telegramCred when you write it. A data feed may not have CRED_ variables in its environment. The placeholder is not a secret, so a config file is a fine place for it. Without cred, the script reads CRED_TELEGRAM… from the environment.

Telegram allows about one message a second per chat and 20 a minute per group. Batch lines into one message rather than sending one per event. A 429 error carries retryAfter in seconds. Wait that long before the next send.

When a call fails

What you see Causes, cheapest to check first
403 from the proxy, body says placeholder_absent You called api.telegram.org without the script, or without the placeholder in the path. Or two Telegram credentials are enrolled.
401 Unauthorized The token was revoked in BotFather, or enrolled with a typo. Ask the user to enrol it again.
404 Not Found A method the credential does not cover. The script sends only the ones listed above.
400 Bad Request: chat not found The user has not messaged the bot, or the bot is not in that group or channel.
403 Forbidden: bot was blocked by the user The user blocked the bot. Only they can unblock it.
403 Forbidden: bot is not a member of the channel chat Add the bot to the channel as an administrator with permission to post.
400 Bad Request: can't parse entities --html text with an unescaped <, > or &.
409 Conflict from chats Something else reads the bot's updates, such as a webhook. Ask the user for the chat id, or @name for a public channel.
several Telegram credentials from the script Two are enrolled. Ask the user to revoke one.

Never edit the script

A publish replaces it. If it does not work, change the smallest thing that makes your command run, run it, and tell the user in one line what you changed, so it can be fixed here.

04 同仓库更多 Skills

tradeparadigm
tradeparadigm/dt-apps

example-api

A skill body that exists so the fixture is a complete app. It teaches nothing and is never published.

★ 0
tradeparadigm
tradeparadigm/dt-apps

paradigm-rfq-trader

Trigger institutional block trades via Paradigm's DRFQv2 flow. The workflow is venue-agnostic — resolve instruments, build the RFQ / order payload, benchmark, run a confirmation gate, submit, verify settlement. Per-venue specifics (fair-value sources, naming conventions, edge syntax, settlement checks) live in references/venues.md. In scope today: PRDX (Paradex, primary focus) and DBT (Deribit). Adding more DRFQv2 venues is a references/venues.md edit, not a skill-body change. Covers takers (build, benchmark, cross) and makers (poll, price, manage). Every state-changing action goes through an explicit confirmation gate. Needs both Paradigm credentials enrolled. Use when the user asks to "send a Paradigm block RFQ", "block-trade X BTC", "send a BTC straddle on Paradex / Deribit", "quote rfq_X", "hit the best bid", "cancel rfq_X". Does NOT cover pricing a structure without trading (its legs' current marks are paradigm-data-discovery's), small central-order-book trades, post-trade analysis (paradigm-block-analyst), historical tape (paradigm-data-discovery).

★ 0
tradeparadigm
tradeparadigm/dt-apps

paradigm-options-recap

Options market recap for a requested or default window, invoked via /recap. Parses "/recap [asset] [options] [window]" (e.g. "/recap btc options 8h") and builds the fixed four-section recap — Snapshot, Biggest Print, Block Flow, Vol Surface — from bounded raw exchange venue files and source tapes, never from Dime hot files, read with the pod's AWS access. Use when the user types /recap or asks for a market recap, an options flow summary, "what happened in BTC options" or "last Xh of flow". A single question is not a recap: the biggest print across venues is paradigm-data-discovery's (paradigm-api reads only Paradigm's own tape), and the vol surface, one IV or one venue's data is paradigm-data-discovery's, as are dataset inventory, schema and historical lookups. The output format is fixed — always the same four sections in the same order.

★ 0
tradeparadigm
tradeparadigm/dt-apps

paradigm-data-discovery

Catalog and query launcher for raw market data available to Dime in s3://dt-exchange-venue-data, s3://dt-paradigm-data, and s3://dt-paradex-data, read with the pod's AWS access. Use for data inventory, coverage, schema and historical analysis, for current venue market data (marks, IV, greeks, OI, funding, spot) on Deribit, OKX, Bybit and Bullish, and for recent block trades when the user has no Paradigm credentials enrolled (with them, paradigm-api reads the live tape). Explains the per-venue raw files and lets the model choose the bounded reads needed for the question. Does not cover account state, positions, vaults, or order placement.

★ 0
tradeparadigm
tradeparadigm/dt-apps

paradigm-block-analyst

Cross-venue analysis of Paradigm RFQ block trades using live market data from Deribit, OKX, and Bybit. Invoked as `/analyze <rfq_id> <rfq description>`: resolves the rfq_id by searching the Paradigm trade tape via the paradigm-data-discovery skill (the daily execution partitions, keyed by RFQ_ID) for the cleared-block record, then fetches live marks, IVs, and greeks per venue, computes net greeks for multi-leg structures, benchmarks the fill vs mark, reports how much of the structure traded over 24h / 7d / 30d and where else it printed, reads whether the flow moved the vol surface, and outputs a concise analysis. Use when the user runs `/analyze <rfq_id> ...`, pastes a Paradigm block trade JSON, or asks to analyze, benchmark, or get market color on a Paradigm RFQ execution. Covers outright calls/puts (CL/PL), strangles (SN), straddles (ST), butterflies (BF), condors (CO), calendars (CA), risk reversals (RR), covered calls, and custom multi-leg combos (CM). Also handles perp combos. Reads the Paradigm trade tape from S3 with the pod's AWS access.

★ 0
tradeparadigm
tradeparadigm/dt-apps

paradigm-api

Paradigm's DRFQv2 RFQ API: recent block trades on the public block tape (`paradigm__paradigm_drfqv2_trades` with `mode: "tape"`), verifying the credentials, instruments, counterparties, listing and creating RFQs, quotes and crosses, cancels, your trades, leg pricing and the maker circuit-breaker. The tools are `paradigm__*` MCP tools, called by exact name, and need the user's Paradigm credentials enrolled. Use for ANY request to Paradigm's REST API, including "recent block trades", "is my Paradigm key working", "list my Paradigm RFQs" or "cancel rfq_...". The tape here is the latest prints only: volumes over time, comparisons across days and whether a structure traded before are paradigm-data-discovery's, and so is the block tape without credentials. The RFQ workflow and its confirmation gate are paradigm-rfq-trader.

★ 0