This n8n workflow demonstrates a simple approach to improve chat UX by staggering an AI Agent's reply for users who send in a sequence of partial messages and in short bursts. How it works Twilio webhook receives user's messages which are recorded in a message stack powered by Redis. The execution is immediately paused for 5 seconds and then another check is done against the message stack for the latest message. The purpose of this check lets use know if the user is sending more messages or if they are waiting for a reply. The execution is aborted if the latest message on the stack differs from the incoming message and continues if they are the same. For the latter, the agent receives the buffered messages up to that point and is able to respond to them in a single reply. Requirements A Twilio account and SMS-enabled phone number to receive messages. Redis instance for the messages stack. OpenAI account for the language model. Customising the workflow This workflow should work for other common messaging platforms such as Whatsapp and Telegram. 5 seconds too long or too short? Adjust the wait threshold to suit your customers.
Tags
Related workflows
See all AI Automation→Slack chatbot powered by AI
This workflow offers an effective way to handle a chatbot's functionality, making use of multiple tools for information retrieval, conversation context storage, and message sending. It's a setup tailored for a Slack environment, aiming to offer an interactive, AI-driven chatbot experience. Note that to use this template, you need to be on n8n version 1.19.4 or later.
Run a Telegram voice and chat assistant with OpenAI, Gmail, Calendar, and Notion
Quick overview This workflow turns a Telegram bot into a personal assistant that understands text or voice notes (transcribed with OpenAI), can read Gmail and Google Calendar, look up Notion tasks and contacts, and can draft and send emails with an approval step in Telegram. How it works Triggers when a new Telegram message arrives. Loads assistant settings (name, OpenAI model, languages, memory window) and checks whether the message is a voice note or plain text. If it is a voice note, downloads the audio from Telegram and transcribes it with OpenAI; otherwise it uses the message text as the user input. Sends the user input to an OpenAI-powered agent that keeps short-term chat memory and decides whether to call Gmail, Google Calendar, or Notion tools to answer the request. If the agent decides to send an email via Gmail, it asks for explicit approval in Telegram before proceeding. Sends the agent’s final response back to the user in Telegram. Setup Create a Telegram bot with @BotFather, add your Telegram credentials in n8n, and start a chat with the bot so it can reply to you. Add an OpenAI API credential and set the desired chat model and transcription language in the Configurati
AI agent chat
This workflow employs OpenAI's language models and SerpAPI to create a responsive, intelligent conversational agent. It comes equipped with manual chat triggers and memory buffer capabilities to ensure seamless interactions. To use this template, you need to be on n8n version 1.50.0 or later.