@robinpath/telegram
0.1.0PublicTelegram Bot API client for sending messages, photos, documents, locations, polls, stickers, and managing chats
@robinpath/telegram
Telegram Bot API client for sending messages, photos, documents, locations, polls, stickers, and managing chats
Why use this module?
The telegram module lets you:
- Get info about the bot (id, first_name, username)
- Send a text message to a chat
- Send a photo from a local file to a chat
- Send a document/file from a local path to a chat
- Send a GPS location to a chat
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/telegram
Quick Start
1. Set up credentials
telegram.setToken "default" "123456:ABC-DEF..."
2. Get info about the bot (id, first_name, username)
telegram.getMe "default"
Available Functions
| Function | Description |
|---|---|
telegram.setToken | Store a Telegram bot token for subsequent API calls |
telegram.getMe | Get info about the bot (id, first_name, username) |
telegram.send | Send a text message to a chat |
telegram.sendPhoto | Send a photo from a local file to a chat |
telegram.sendDocument | Send a document/file from a local path to a chat |
telegram.sendLocation | Send a GPS location to a chat |
telegram.sendPoll | Send a poll to a chat |
telegram.editMessage | Edit the text of an existing message |
telegram.deleteMessage | Delete a message from a chat |
telegram.getUpdates | Receive incoming updates via long polling |
telegram.sendSticker | Send a sticker by file_id to a chat |
telegram.getChat | Get up-to-date information about a chat |
Examples
Get info about the bot (id, first_name, username)
telegram.getMe "default"
Send a text message to a chat
telegram.send "default" "-100123456" "Hello from RobinPath!"
Send a photo from a local file to a chat
telegram.sendPhoto "default" "-100123456" "/tmp/photo.jpg" {"caption": "Look at this!"}
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/telegram";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
telegram.setToken "default" "123456:ABC-DEF..."
telegram.getMe "default"
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/slack— Slack module for complementary functionality@robinpath/discord— Discord module for complementary functionality@robinpath/teams— Teams module for complementary functionality@robinpath/whatsapp— WhatsApp module for complementary functionality@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.0 | latest | yesterday |
Related Modules
@robinpath/discord
Discord module for RobinPath.
@robinpath/notification
Unified notifications: Slack, Discord, Telegram, and MS Teams via webhooks
@robinpath/notify
Notify module for RobinPath.
@robinpath/slack
Slack Web API and Incoming Webhooks client for messaging, channels, reactions, file uploads, and user management
$ robinpath install @robinpath/telegram
