### Running the ElizaOS Project Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md Commands to start the ElizaOS project with the Telegram plugin, using either npm or bun. ```bash npm run dev ``` ```bash bun start --character="characters/your-character.json" ``` -------------------------------- ### Telegram Plugin Configuration Example Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md An example JSON configuration file for the Telegram client plugin, demonstrating all available options including client type, message handling, group restrictions, and custom templates. ```json { "clients": ["telegram"], "allowDirectMessages": true, "shouldOnlyJoinInAllowedGroups": true, "allowedGroupIds": ["-123456789", "-987654321"], "messageTrackingLimit": 100, "templates": { "telegramMessageHandlerTemplate": "Your custom template here" }, "secrets": { "key": "" } } ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md Instructions for setting up the Telegram bot token using an environment variable in the `.env` file. ```env TELEGRAM_BOT_TOKEN=your-bot-token ``` -------------------------------- ### Initiate Telegram Authentication Handshake Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md Defines an action to initiate a Telegram authentication handshake. It checks if a user exists and, if not, sends a message with a Telegram login button to guide the user through the setup process. This action is triggered when the message source is 'telegram'. ```typescript export const initAuthHandshakeAction: Action = { name: 'INIT_AUTH_HANDSHAKE', description: 'Initiates the identity linking and authentication flow for new users.', validate: async (_runtime, _message, _state) => { return _message.content.source === 'telegram'; }, handler: async (runtime, message, _state, _options, callback): Promise => { try { const user = await getUser(message.userId); if (user) return false; callback({ text: "Let's get you set up with a new account", buttons: [ { text: '🔑 Authenticate with Telegram', url: `${FRONTEND_URL}/integrations/telegram`, kind: 'login', }, ], }).catch((error) => { console.error('Error sending callback:', error); }); return true; } catch (error) { ... } }, }; ``` -------------------------------- ### Character Configuration with Bot Token Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md Example of how to add the bot token to the character configuration file (`your-character.json`) for the Telegram plugin. ```json { "clients": ["telegram"], "secrets": { "key": "" } } ``` -------------------------------- ### Telegram Button Structure Source: https://github.com/elizaos-plugins/plugin-telegram/blob/1.x/README.md Describes the structure for creating native Telegram buttons within messages. This includes the button's text, the URL it links to, and its kind, such as 'login'. ```APIDOC TelegramButton: text: string - The text displayed on the button. url: string - The URL the button links to. kind: 'login' | 'web_app' - The type of button. 'login' initiates a Telegram login flow, 'web_app' opens a web app. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.