I am building a system using n8n and an API. I aim to create a process where, upon requesting bus location information via Telegram, the result is sent back to Telegram.
The current process I have developed is as follows:
- When a question is asked through chat,
- The AI agent analyzes the chat input and extracts it into a JSON format with “location” and “num_bus”.
- The extracted data is used in an HTTP request node to retrieve API results.
- A code node is utilized to extract only the necessary information for the second API query.
Problem:
If there is only one result, it can be easily inserted into the second API query to retrieve the results. However, if there are two or more results, a selection needs to be made. While I am using various nodes, what I am curious about is how to ask the user for input when multiple results are present, so that their response can trigger the execution of the corresponding node.
For example:
- Question: “More than one result was found. Which result would you like to proceed with?” Response: “Please run result number 2.”
- The second result is sent to the second API, and the output is then provided as a response via Telegram.
Is there a way to achieve this? Or do you have any ideas for a workaround?
Information on your n8n setup
- n8n version: Version 1.65.2
- Database: PostgreSQL
- n8n EXECUTIONS_PROCESS setting: own
- Running n8n via: Docker-starter kit
- Operating system: Mac OS