-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(telegram): added delete message,send photo-video-audio-animation… #1563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(telegram): added delete message,send photo-video-audio-animation… #1563
Conversation
|
@SimplyRohit is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR significantly expands the Telegram integration from a single text message tool to a comprehensive multimedia and message management suite. The changes introduce five new tools for sending different media types (animations, photos, videos, audio) and deleting messages, addressing issue #1562.The implementation follows a consistent architectural pattern across all new tools, using shared authentication parameters (botToken, chatId) and standardized response handling. The original telegram_message tool has been renamed to telegram_send_message to align with the new naming convention (telegram_send_* pattern). All media tools support optional captions with automatic markdown-to-HTML conversion using the existing convertMarkdownToHTML utility.
The changes integrate seamlessly with the existing codebase structure. The telegram/index.ts serves as the central export hub for all tools, the individual tool files follow the established ToolConfig pattern with proper TypeScript typing, and the tools registry is updated to include all new functionality. The Telegram block configuration has been enhanced with a dropdown operation selector and conditional form fields, providing a unified interface for all Telegram operations while maintaining clean separation of concerns.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| apps/sim/tools/telegram/index.ts | 5/5 | Entry point restructured to export six Telegram tools with consistent naming |
| apps/sim/tools/telegram/message.ts | 3/5 | Refactored existing message tool with new naming and response structure |
| apps/sim/tools/telegram/delete.ts | 3/5 | New tool for deleting Telegram messages with debug statement and error handling issues |
| apps/sim/tools/telegram/types.ts | 3/5 | Expanded type definitions for all media types with some type inconsistencies |
| apps/sim/tools/telegram/animation.ts | 4/5 | New tool for sending animations with proper structure but verbose output schema |
| apps/sim/tools/telegram/photo.ts | 4/5 | New tool for sending photos with clean implementation following established patterns |
| apps/sim/tools/telegram/video.ts | 3/5 | New tool for sending videos with error handling and type consistency issues |
| apps/sim/tools/telegram/audio.ts | 3/5 | New tool for sending audio files with missing error handling and type mismatches |
| apps/sim/blocks/blocks/telegram.ts | 4/5 | Enhanced block with operation selector and conditional fields for unified interface |
| apps/sim/tools/registry.ts | 4/5 | Updated registry with all new Telegram tools, includes breaking change |
Confidence score: 3/5
- This PR introduces comprehensive functionality with some implementation issues that need attention before merging
- Score reflects good architectural consistency but concerns about error handling, type safety, and debug statements across multiple files
- Pay close attention to delete.ts, types.ts, and the error handling patterns in new media tools
Sequence Diagram
sequenceDiagram
participant User
participant TelegramBlock
participant TelegramAPI
User->>TelegramBlock: "Configure operation (send message/photo/video/audio/animation/delete)"
User->>TelegramBlock: "Provide bot token"
User->>TelegramBlock: "Provide chat ID"
alt Send Message
User->>TelegramBlock: "Provide message text"
TelegramBlock->>TelegramAPI: "POST /sendMessage with text"
TelegramAPI-->>TelegramBlock: "Return message data"
else Send Photo
User->>TelegramBlock: "Provide photo URL/file_id and caption"
TelegramBlock->>TelegramAPI: "POST /sendPhoto with photo data"
TelegramAPI-->>TelegramBlock: "Return photo message data"
else Send Video
User->>TelegramBlock: "Provide video URL/file_id and caption"
TelegramBlock->>TelegramAPI: "POST /sendVideo with video data"
TelegramAPI-->>TelegramBlock: "Return video message data"
else Send Audio
User->>TelegramBlock: "Provide audio URL/file_id and caption"
TelegramBlock->>TelegramAPI: "POST /sendAudio with audio data"
TelegramAPI-->>TelegramBlock: "Return audio message data"
else Send Animation
User->>TelegramBlock: "Provide animation URL/file_id and caption"
TelegramBlock->>TelegramAPI: "POST /sendAnimation with animation data"
TelegramAPI-->>TelegramBlock: "Return animation message data"
else Delete Message
User->>TelegramBlock: "Provide message ID to delete"
TelegramBlock->>TelegramAPI: "POST /deleteMessage with message ID"
TelegramAPI-->>TelegramBlock: "Return deletion confirmation"
end
TelegramBlock-->>User: "Return operation result with message data"
10 files reviewed, 13 comments
|
@SimplyRohit this is great! Can we just ack the PR comments, I agree with them all asides from the two that I left |
|
|
@SimplyRohit can you also change the base of the PR to staging instead of main? |
got it, updated to staging |
|
merged in #1625 |
… tools
Summary
This PR extends the Telegram integration by adding new tool modules to handle:
Fixes #1562
Type of Change
Testing
Verified each Telegram tool individually
Confirmed successful message send, delete, and media operations on Telegram bot
Ensured build and lint checks passed after import reordering and Biome formatting
Checklist
Screenshots/Videos