Quick overview
This workflow acts as a virtual legal secretary on Telegram, using OpenAI and Google Calendar to collect client details, check availability, book 30‑minute consultations, and message both the client and an internal secretary chat in Portuguese (Brazil).
How it works
- Triggers when a client sends a Telegram message to the bot.
- Uses an OpenAI-powered agent with conversation memory to collect intake details, offer predefined time slots in the America/Porto_Velho timezone, and decide whether to reply, book, cancel, or escalate.
- Checks Google Calendar availability (and can delete an existing event) when the agent requests calendar actions.
- Parses the agent’s structured JSON output and routes the flow based on whether the action is a booking or a normal reply.
- If booking is requested, creates a Google Calendar event with the client and consultation details, then sends a formatted confirmation to the client and notifies the secretary via Telegram.
- If booking is not requested, sends the agent’s reply message back to the client via Telegram.
Setup
- Add Telegram bot credentials and ensure the Telegram Trigger is correctly connected to your bot.
- Add an OpenAI API credential for the Chat Model used by the agent.
- Add Google Calendar OAuth2 credentials and select the target calendar ID used for checking availability and creating/deleting events.
- Set the secretary’s Telegram chat ID used for escalation and booking notifications.
- Set the workflow (and Google Calendar) timezone to America/Porto_Velho to match the agent’s scheduling rules.