Trigger Flows from Telegram
How to trigger Flows when receiving messages in Telegram.
This guide explains how to configure a webhook in Flows to receive triggers from a Telegram bot. By using the "Set Webhook" stage, you can automatically process incoming messages from Telegram and trigger a specific flow in Flows.
Prerequisites
Before setting up the webhook, ensure that:
1. You have created a Telegram bot via BotFather and obtained its API token.
2. You have created a connection in your Telegram app settings in Flows.
3. You have an enabled and public flow in Flows that you want to trigger.
Step-by-Step Guide
Step 1: Create a Flow in Flows
Navigate to Flows and create a new flow with manual trigger.
Configure the flow logic based on what should happen when the Telegram bot receives a message.
Ensure that the flow is enabled and set to public.
Copy the Flow ID from the flow settings (this will be needed for the webhook setup).
Step 2: Set Up the Webhook in Flows
Add a Telegram - Set Webhook stage to a new manual trigger flow.
Select your Telegram connection from the dropdown.
Paste the Flow ID that you copied earlier into the "Flow ID" field.
Run the test suite once and check that you got a successful response. If the Telegram stage errored - add a "return dictionary" stage and check the response from Telegram
Step 3: Test the Webhook
Open Telegram and send a message to your bot.
Your flow should be triggered automatically. You can add a message to Slack in your triggered flow using {{qDictionary}} to see the full payload sent from Telegram.
Important Notes
The Flow ID must match the one in the enabled public flow.
If your flow is not triggering, ensure it is set to public in the flow settings.
The webhook will only work with messages sent directly to the bot and not messages from groups unless explicitly configured.
Troubleshooting
Issue: The flow is not triggering.
Solution: Ensure the flow is enabled and public.
Solution: Double-check that the correct Flow ID is entered in the webhook stage settings and that you ran the test suite successfully.
Solution: Verify that the Telegram bot is properly connected in Flows with the correct API key.
Issue: Webhook is not receiving messages.
Solution: Ensure that the Telegram bot is active and responding to messages.
Solution: Check Flows logs for errors and reconfigure the webhook if necessary.
By following these steps, you should be able to successfully set up and use a webhook in Flows to receive messages from your Telegram bot!