SDK example plugin — demonstrates tools(sdk) with database, TON, and Telegram features.
Use this as a starting point for plugins that need blockchain or messaging access.
cp -r plugins/example-sdk plugins/your-plugin| Tool | Description |
|---|---|
sdk_greet |
Greet a user and track count in isolated database |
sdk_balance |
Check TON wallet balance and USD price |
sdk_announce |
Send a message with optional inline buttons (DM only) |
mkdir -p ~/.teleton/plugins
cp -r plugins/example-sdk ~/.teleton/plugins/Ask the AI:
- "Greet me"
- "What's the wallet balance?"
- "Send an announcement saying 'Hello world' with buttons"
tools(sdk)— receiving the SDK instead of using a plain arraysdk.db— isolated SQLite database viamigrate()exportsdk.ton— wallet address, balance, and price (read methods return null on failure)sdk.telegram— sending messages with inline keyboardssdk.pluginConfig— reading config with defaults frommanifest.defaultConfigsdk.log— prefixed loggingscope: "dm-only"— restricting a tool to DMs only- Error handling — catching
PluginSDKErrorfrom write methods - Inline manifest —
export const manifestalongsidemanifest.json
Optional overrides in ~/.teleton/config.yaml:
plugins:
example_sdk:
greeting: "Hey"Default: "Hello" (from manifest.defaultConfig).
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | — | Name to greet |
No parameters.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
text |
string | Yes | — | Announcement text |
with_buttons |
boolean | No | false | Include inline buttons |