This n8n template uses a Telegram chatbot to conduct a Product Satisfaction Survey and fetches questions, storing answers in a Google sheet. It augments an AI Agent to ask follow-up questions to engage the user and uncover more insights in their responses.

This template is intended to demonstrate how you’d realistically approach a workflow where there is structured conversation (static questions) but you still want to include a free-form element (follow-up questions) which can only be accomplished via AI.

How it works

A chat session is started with the user who needs to enter the bot command “/next” to start the survey.

Once started, the template pulls in questions from a Google sheet to ask the user. Questions are asked in sequence from the left column to the right column.

When the user answers the question, a text classifier node is used to determine if a follow-up question could be asked.

If so, a mini conversation is initiated by the AI agent to get more details. If not, the survey proceeds to the next question.

All answers and mini-conversations are recorded in the Google Sheet under the respective question. When all questions are answered, the template will stop the survey and give the user a chance to restart.

How to use

1. You’ll need to set up a Telegram bot (see docs).
2. Create a Google sheet with an ID column. Populate the rest of the columns with your survey questions (see sample).
3. Ensure you have a Redis instance to capture state. Either self-host or sign up to Upstash for a free account.
4. Update the “Set Variable” node with your Google sheet ID and survey title.
5. Share your bot to allow others to participate in your survey.

Requirements

– Telegram for Chatbot
– Google Sheets for Survey questions and answers
– Redis for State Management and Chat Memory
– Community+ license and above for Execution data node – you can remove this node if you don’t have this license.

Customizing this workflow

Not using Telegram? This template technically works with other chat apps such as WhatsApp, WeChat, and even n8n’s hosted chat!

This state management pattern can also be applied to other use-cases and scenarios. Try it for other types of surveys!