I’m building a Telegram bot automation in callin.io to handle AI-assisted script and audio generation for content creation.
Goal:
The user interacts with a Telegram bot, selects from a menu using inline keyboard buttons, and depending on the option:
• Enters a message
• That message is processed by an external AI API
• The result is optionally revised based on user input
• Once finalized, it’s sent to a text-to-speech service
• The audio is passed through an automatic silence remover
• Final audio file is uploaded to cloud storage and the link is sent back to the user
⸻
How It’s Structured:
Workflow 1: Entry Point
• Trigger: Telegram Trigger (message)
• Filters for /start
• Sends a greeting message with inline keyboard (3 buttons via reply_markup)
• Waits 2 seconds before sending the button prompt for UX smoothness
Workflow 2: Callback Query Handler
• Trigger: Telegram Trigger (callback query)
• Switch node routes the button pressed to the appropriate path (e.g. Option 1 starts the creation flow)
• Asks user to submit a message
• Sends it to Claude (Anthropic API) or other external AI
• Returns result, asks if they want changes or type done
• Loop based on user input until final version is confirmed
• Sends script to ElevenLabs
• Audio result passed to a silence-removal script
• Cleaned audio is uploaded to Google Drive (or cloud of choice)
• Final link is sent back to Telegram
⸻
Issues I’m Running Into:
- Multiple Workflows: Shared Context
Since I’m using two workflows (one triggered by message, the other by callback query), I’m struggling to:
• Pass the chat ID or session info from the first workflow into the second
• Maintain a smooth conversational flow across workflows
Is there a way to:
• Use one trigger node to handle both message and callback queries in the same workflow?
• Or pass chat context from one workflow to another cleanly?
- Restarting the Workflow
If the user sends /start again halfway through a flow, it doesn’t trigger the first workflow again.
I need to let users reset the flow at any time by typing /start again. Currently, this seems to be ignored once a workflow has already run for that user.
Any ideas on:
• Forcing /start to always restart the main workflow from the top?
• Or managing user sessions in a way that supports re-entry?
⸻
Bonus Steps:
• Audio is processed by a Python-based silence remover script (can run via Execute Command or external service)
• Final file naming and delivery is dynamic (e.g., title (channel).mp3)
⸻
Would really appreciate help figuring out how to:
• Consolidate this into one workflow if possible
• Or manage flow context + triggers cleanly across workflows
•
And support /start as a true “reset” command at any point
Thanks in advance!
Hi,
Could you please share your workflow within a code section?
I believe the only way this could function is by utilizing a shared state across all elements. How is state currently managed? This state/context should be maintained and checked before interacting with the AI.
I can envision something like this:
-
Within the workflow, if you've saved state in an external system with a sufficiently large window, the AI should be able to access it between workflows.
-
If you intend to handle
/start
for an existing session, I suppose you could check the session ID or whatever you utilize from memory and clear everything (directly from the database). This action would effectively reset any subsequent requests from any workflow, causing it to lose its "memory".
Regards,
J.
This thread was automatically closed 90 days following the last response. New responses are no longer permitted.