Did you know that it’s possible to create a chatbot with artificial intelligence using agents created on Tess AI? That’s the idea behind the use case we’re going to explore today. We’ll build together a medical anamnesis chatbot, built with Tess AI and the N8N automation platform.
This article is based on a super detailed live session (and a little technical!) that you can check out in full here:
Get ready: let’s consider this intermediate-advanced level content. If you are just starting with Tess AI, don’t worry! The platform is simpler for everyday use. This case is for those who want to dive deeper, use the API, and connect Tess AI with other tools.
Database or spreadsheet: It stores the history of conversations, allowing the chatbot to "remember" previous interactions with the same user. You can use the database of your choice, or even a spreadsheet if you're not going to store too many interactions. In the example, we used the free plan of Supabase.
WhatsApp API: You will need to integrate a WhatsApp API to capture the messages sent to you and respond to them within WhatsApp. We used the Avisa API in the example, but you can choose the API you prefer, whether it's official or unofficial.
Automation tool: We used N8N to automate this flow because it offers the best cost-benefit for this specific type of automation. However, the same logic would also work with other platforms like Make (formerly Integromat) and Zapier.
Imagine the following scenario: a patient schedules a telemedicine appointment. Before the consultation, a chatbot contacts them via WhatsApp to carry out the anamnesis, that is, to collect information about the patient’s medical history, symptoms, etc. This speeds up the service, allowing the doctor to start the consultation with relevant information already in hand.
The chatbot we’ll create here is a virtual assistant called "Susana," a friendly and empathetic virtual nurse. She was "trained" (through a prompt detailed in Tess AI) to conduct anamnesis in a natural and welcoming way.
Now, let’s get to the point: how to build the flow in N8N. The overall structure is as follows:
Webhook: A "trigger" that monitors WhatsApp. When a new message arrives, the webhook is activated.
"Parse JSON": The WhatsApp API sends a lot of information together. This block "separates" that info into individual variables.
"Create Variables": An optional but useful block that organizes the main variables (phone, name, message, etc.) to make them easier to use in the rest of the flow.
"Is it a Group?": An "if" block that checks if the message came from a group. In this case, the flow ignores group messages (but you can create a separate flow for groups if you want).
"Supabase Check": Checks if there's already a conversation history with the phone number that sent the message.
"Switch (First Message?)": A block that directs the flow. If it’s the first message, it creates a new record in Supabase. If there’s already a history, it continues the existing conversation.
"Tess AI Agent": The "brain" of the chatbot. Sends the user's message to Tess AI and receives the response.
"Send via API (or your WhatsApp API)": Sends the chatbot’s response back to the user on WhatsApp.
"Log in Supabase (only for first conversation)": Creates a new record in the database, storing the conversation ID (root ID) for future interactions.
Tips:
Test: Use the webhook test URL to test the flow without sending messages to all your WhatsApp contacts.
Monitor executions: Use the "Executions" tab in N8N to see what's happening and identify errors.
Refine the prompt: The prompt for the agent in Tess AI is crucial. Try different formulations to get the best results.
Remember to replace the Test URL with the Production URL when you want to activate the flow for your contacts.
This article introduced a practical and powerful use case for Tess AI: an anamnesis chatbot for WhatsApp. With the combination of Tess AI, N8N, and a WhatsApp API, you can automate tasks, streamline processes, and improve the customer (or patient, in this case) experience. While this guide covers the basics, the possibilities are vast. Explore, experiment, and adapt this use case to fit your needs!