Ask a question via Telegram and wait for response?

Hi !

I use n8n since somes weeks and what a great piece of software !
Now that I moved all my automations from other sites to my n8n, I want to go further:
An automation I want to make needs a user input (basically “yes”/“no”) and I want to make it with Telegram if possible (I already use it to send messages in other automations).

Here is the workflow I want to make:

Here is the problem: I know how to send the question with the expected answers but I don’t know how to get the user’s answer. I see there is a lot of Telegram nodes but I don’t found a suitable one…

Can someone help me ? :slight_smile:

Hi @CodeRider883, welcome to the community!

I think the Wait node is a great approach for such a use case.

In your Telegram node you could send a message including the $execution.resumeUrl generated by the Wait node, then attach a parameter indicating the user response. This answercould work for example like so:

This is how it looks in Telegram:

This approach can also be transferred to services other than Telegram (anything capable of displaying links), so is quite flexible. The only downside is that you don’t see the response in real-time on your n8n canvas when building your workflow but have to switch to the execution view instead:

Hope this helps! Let me know if you have any questions on this :slight_smile:

1 Like

Hi !
Thank you for your help, it works and I love the fact that it can be used by other services (Sometimes I use Ntfy).

Although this method works, do you know how to answer using the buttons feature? I think it’s Telegram specific and requires something other than the wait node but I don’t see how to do it…

I know how to send a message with buttons but don’t know how to handle answer:

Hi @CodeRider883, using the inline keyboard would also work, but is a bit more complicated.

You’d need to set up the Telegram trigger node which is quite restrictive. It would use webhooks under the hood and Telegram allows exactly one active webhook at a time. So you can’t have multiple workflows using the Telegram trigger node, and you also can’t have an active workflow and execute it manually at the same time.

It also means you can’t access the data from your current execution, as each button press would start a new workflow execution.

If you’d still like to use the keyboard, your first workflow could look like so:

Your second workflow (handling the inline button actions and everything else coming from Telegram) could look like so:

This is how the question looks like on my phone:

The example trigger workflow echos the answer given by the user, this message appears on the very top of the chat for a brief moment:

Hope this helps!


Awesome, thank you very much !

While I understand cons and limitations of this second method, I will save it as a template if I need to use it.
I will probably use more often the first method for automations where I am the only recipient but maybe the second method with one or two automations where other people are in the chat.

I appreciate your help :slight_smile:

1 Like

A question comes to my mind: let’s say I have two workflows that use method 2, I should have two other workflows to handle answers.
How can I do to redirect to the good answer workflow ? Should I use another callback name in each buttons and add an “if” block at the start of these workflows to verify the callback name ? So when an answer is send, it will trigger all answer workflows ?

Adding more context to the callback data, helping you identify to which request an answer belongs seems like a good approach to me.

Keep in mind you can only have a single active trigger node due to the aforementioned Telegram restriction though. So you’d need to do the filtering in a single “answer handling workflow”.

Ok so even if I have two question workflows with really different subjects, I have to process their answers in only one answer workflow ? Maybe on “big answer workflow” which acts as a switch that starts related question “answser workflow” by passing data… I will try.

The downside with the first method is that when you click on the answer link, Telegram asks you if you want to open the link and opens it’s internal browser to show a webpage with json saying “Workflow was started”. To me it’s ok but for my wife or other persons, they will be afraid… :sweat_smile:

Thank you for your help, I now see what I can do ! :slight_smile:

1 Like

You can also consider creating multiple different Telegram bots for different purposes - this might be easier to implement from a workflow perspective, but might be slightly more confusing for your users.

As for the webhook message, you can customize the Response behaviour on the Wait node:


Nice, thank you so much for all these details !


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