Bot de gestión de eventos en Telegram
Este flujo es utilizado para mediante una integración con telegram programar eventos en google calendar
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
TelegramWebhook-no237[Telegram Webhook]
style TelegramWebhook-no237 stroke:#a170ff
ParseData-e810l[<div><img src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Message]
style ParseData-e810l stroke:#a170ff
TelegramMessage-m4cr5[Telegram Message]
style TelegramMessage-m4cr5 stroke:#a170ff
googlecalendarcomponent-xva04[Crear Eventos]
style googlecalendarcomponent-xva04 stroke:#a170ff
GoogleGenerativeAIModel-cx7b4[Gemini]
style GoogleGenerativeAIModel-cx7b4 stroke:#a170ff
AdvancedAgent-27y8e[Agent]
style AdvancedAgent-27y8e stroke:#a170ff
TelegramWebhook-no237 -.- ParseData-e810l
linkStyle 0 stroke:#a170ff
ParseData-e810l -.- AdvancedAgent-27y8e
linkStyle 1 stroke:#a170ff
TelegramMessage-m4cr5 -.- AdvancedAgent-27y8e
linkStyle 2 stroke:#a170ff
googlecalendarcomponent-xva04 -.- AdvancedAgent-27y8e
linkStyle 3 stroke:#a170ff
GoogleGenerativeAIModel-cx7b4 -.- AdvancedAgent-27y8e
linkStyle 4 stroke:#a170ff
Bot de gestión de eventos en Telegram
🧩 Overview
This workflow automates the process of receiving user requests via Telegram and managing calendar events in Google Calendar. It listens for incoming messages, interprets the user's intent to create or manage events, and uses an AI agent to execute the appropriate actions. The system ensures clear communication by sending a confirmation or result back to the user on Telegram, providing a seamless personal assistant experience.
⚙️ Main Features
- Receives and processes user messages from a Telegram webhook.
- Extracts and structures key information such as the user's message, chat ID, and message ID.
- Utilizes an AI agent to interpret natural language requests and decide on the necessary actions.
- Integrates with Google Calendar to create events based on user instructions.
- Sends automated responses back to the user on Telegram to confirm actions or provide results.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Telegram Webhook | Receives the initial user message and payload from the Telegram platform. | Incoming webhook data containing the user's message and metadata. | Raw message data for processing. |
| Parse Message | Structures the raw webhook data by extracting the user's text, chat ID, and message ID into a clear format. | Raw webhook data. | Formatted text containing the user message, chat ID, and message ID. |
| Gemini Model | Provides the core language model capability that powers the AI agent's reasoning and decision-making. | Model configuration parameters. | A configured language model instance for the agent. |
| Create Events (Google Calendar) | Serves as a tool for the agent to interact with Google Calendar, allowing it to create events. | Tool configuration and description. | A tool that the agent can call to create calendar events. |
| Telegram Message | Serves as a tool for the agent to send text messages back to the user on Telegram. | Tool configuration and description. | A tool that the agent can call to send responses. |
| Agent | The central AI component that interprets the user's request, decides which tools to use (e.g., create a calendar event), and orchestrates the execution. | User's formatted message, the language model, and available tools (Telegram and Google Calendar). | A final response message based on the outcome of the executed actions. |
🧠 Notes
- The workflow is triggered by an incoming message from a Telegram bot webhook.
- The AI agent is instructed to use a strict ISO 8601 date format (YYYY-MM-DD for all-day events, YYYY-MM-DDTHH:MM:SS for timed events) when creating calendar events to ensure precision.
- The agent's system prompt explicitly instructs it to conclude its execution by sending a result message back to the user via Telegram.
- The workflow requires valid API credentials for Telegram Bot and Google services to function.
- The agent's reasoning is limited by a maximum iteration count to prevent infinite loops.