Telegram - Ask User and Respond with Action in same workflow

Hi, I want to make a workflow with Telegram with the following logic:

  1. Telegram Trigger is activated by message
  2. HTTP Request is calling a endpoint (weather)
  3. Telegram responds with the weather forcast with the options to save this call (yes or no)
  4. If the user clicks yes in the inline response it will save the weather forcasts to a spreadsheet

My problem is that I cannot find any way to make the same workflow respond to that request to yes or no save the called forcast to a spreadsheet.

Is there any way to do it in the same workflow, or do I have to configure it, so the callback data for “yes” contains all the data needed to safe it to a spreadsheet in a additional run of the workflow, where it is routed depending on the callback data contained?

or do I have to configure it, so the callback data for “yes” contains all the data needed to safe it to a spreadsheet in a additional run of the workflow

Pretty much this I am afraid (or alternatively store the data you need somewhere and fetch it once your next execution is triggered). This will be true for several services, not just Telegram as n8n does not come with pre-built logic for such scenarios. Or in other words, execution data from one execution is not easily available in another execution.

There is, however, one exception: When using the Wait node you can halt the execution until an HTTP request takes place. So if you use a GET request, you could respond with the unique $resumeWebhookUrl in your Telegram message. A user could then click the link and the execution would continue with all available data. You can also append query parameters (such as answer=yes or answer=no) to account for different answers.

This wouldn’t use any Telegram-specific functionality though. On the plus side it’d be relatively easy to re-use such logic with another messenger (or even outside of messengers).

Thank you, I almost thought so. Handling callback requests I than used the same Telegram Trigger Node with a if node after it to filter out all for not-empty callback requests.

As the callback request is having all the message data included I can use a Telegram Node to respond or edit the message acoording to the desired outcome.

So If I send out a message to a user via Telegram with a inline yes or no it is one workflow.
The user answers to that message via the inline keyboard is another execution of that same or additional workflow, depending on the desired outcome.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.