Skip to main content

Artificial Intelligence

Intelligent Automation in the Healthcare Sector with n8n, OpenAI, and Pinecone

D4ca3c9a 67d2 41ff 9766 Ed3f197d48c9 94811792

Abstract

In today’s digital-first world, healthcare organizations face increasing pressure to modernize operations and improve service delivery. Intelligent automation is no longer a luxury (it’s the foundation for scalable, efficient, and personalized healthcare systems). At Perficient, we’re driving innovation by integrating tools like n8n, Azure OpenAI, and Pinecone to develop smarter, context-aware solutions for the medical field.

This blog explores how we built an automation pipeline that connects clinical data ingestion, semantic search, and conversational interfaces (without the need for complex infrastructure). Using n8n as the orchestration engine, we retrieve medical records, process them through Azure OpenAI to generate embeddings, and store them in Pinecone, a high-performance vector database.

To complete the experience, we added an AI-powered Telegram assistant. This bot interacts with users in real time (patients or staff), answers questions, retrieves medical data, and checks doctor availability by leveraging our semantic layer.

This architecture proves how low-code platforms combined with enterprise AI and vector tools can deliver conversational and data-driven healthcare experiences. Whether you’re a provider, architect, or innovator, this solution offers a real glimpse into the future (where decisions are supported by smart, contextual agents and users get meaningful, accurate answers).

If you need mor information about Chunks and Embeddings, and Vector Databases, you can visit this previous Post:

https://blogs.perficient.com/2025/07/07/turn-your-database-into-a-smart-chatbot-with-openai-langchain-and-chromadb/

Proof of Concept

A simple proof of concept (POC) was developed to demonstrate how an automation and AI-based solution can effectively integrate into real clinical environments. This prototype allows users to quickly and contextually check a patient’s recorded medical visits (including relevant data such as weight, height, consultation date, and clinical notes) and verify whether a healthcare professional is available for a new appointment. The solution, built using visual workflows in n8n and connected to a structured medical database, shows how accurate and helpful responses can be delivered through a channel like Telegram (without the need for complex apps or multiple steps). All of this was achieved by combining tools like Pinecone for semantic search and Azure OpenAI for natural language understanding, resulting in a smooth, user-centered conversational experience.

Creation Embeddings Flow

For the AI assistant to provide useful and contextual responses, all information related to medical appointments and clinical records must be transformed into a format that allows it to truly understand the content (not just read it literally). That’s why the first automation focuses on converting this data into embeddings (numerical representations that capture the meaning of the text).

This process runs automatically every hour, ensuring that any new data (such as a recent appointment or updated clinical note) is quickly processed and indexed. The workflow begins with an API call that retrieves the most recent clinical records or, if it’s the first run, the entire medical history. The data then goes through a processing and cleanup stage before being sent to Azure OpenAI, where the corresponding embeddings are generated.

These vectors are stored in Pinecone, a system specialized in semantic search, allowing the AI assistant to retrieve relevant information accurately (even when the user doesn’t phrase the question exactly as it was recorded).

Thanks to this preparation step, the assistant can respond with specific details about diagnoses, consultation dates, or previously recorded information (all without the user having to manually search through their history). This approach not only improves the user experience, it also ensures that the information is available at the right time and communicated in a natural way.

Imagen1

Figure 1: Creation Embeddings Flow

Once the SQL query is executed and the clinical data is retrieved (including patient name, appointment date, medical notes, professional details, and vital signs), the records go through a transformation process to prepare them for embedding generation. This step converts the content of each appointment into a numerical format (one that the language model can understand), enabling more accurate contextual searches and more relevant responses when the assistant queries the information.

Imagen 2

Figure 2: Clinical Data Embedding Pipeline, SQL Section

The vectorization process was carried out using the Pinecone Vector Store node, which handles the storage of the generated embeddings in a database specifically designed for high-speed semantic searches. This step ensures that the clinical information is organized in a format the assistant can easily query (even when the user’s questions don’t exactly match the original wording), significantly improving the accuracy and usefulness of each response.

Imagen 3

Figure 3: Clinical Data Embedding Pipeline, Creation of the Chunks

Imagen 4

Figure 4: Clinical Data Embedding Pipeline, Creation of the embeddings

Creation Embeddings Flow

This second workflow allows users to interact directly with the system through Telegram, using a conversational assistant connected to language models and external tools. When a message is received, the AI Agent analyzes the request (supported by an Azure OpenAI model and an internal memory that maintains context) and decides what action to take. If the user asks about medical history, the agent queries the vector store stored in Pinecone (via the Medical_History node) to retrieve relevant information. If the request is related to a doctor’s availability, the agent connects to the medical database through the Agenda_Doctors node. Finally, the response is sent back through Telegram in natural language (clear and to the point), allowing for a conversational experience that is agile, helpful, and aligned with the needs of a clinical environment.

Imagen 5

Figure 5: AI-Powered Telegram Assistant for Clinical Queries

This image shows a real example of the assistant working within Telegram. Through a natural conversation, the bot is able to identify the patient by last name, retrieve their full name, and then provide the date and time of their last medical appointment (including the doctor’s name and specialty). All of this happens within seconds and without the need to navigate through portals or forms, demonstrating how the integration of AI, semantic search, and instant messaging can streamline access to clinical information in a fast and accurate way.

Imagen 6

Figure6: Real-Time Patient Query via Telegram Assistant

Conclusions

  • Intelligent automation improves efficiency in clinical environments
    By combining tools like n8n, Azure OpenAI, and Pinecone, it’s possible to build workflows that reduce repetitive tasks and provide faster access to medical information (without constant manual intervention).

  • Vectorizing clinical data enables more accurate queries
    Transforming medical records into embeddings allows for more effective semantic searches (even when users don’t phrase their questions exactly as written in the original text).

  • Conversational assistants offer a natural and accessible experience
    Integrating the workflow into platforms like Telegram lets users interact with the system in an intuitive and direct way (without technical barriers or complex interfaces).

  • Hourly updates ensure information is always current
    Running the embedding process every hour keeps the system in sync with the latest records (which improves the accuracy and relevance of the assistant’s responses).

  • A well-structured POC shows the real value of AI in healthcare
    Even as a prototype, this case demonstrates how artificial intelligence can be applied in a concrete and functional way in the healthcare sector (enhancing both user experience and internal processes).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Juan Quintana Gomez

Juan is a .Net and web developer with 14 years of experience with C# and Microsoft technologies. He is a recursive professional with a critical and competitive attitude. Juan has worked with Scrum and Agile methodologies. In his last projects, Juan was responsible for being a senior developer and working as a leader. Juan is proactive, creative, and accountable, capable of generating solutions to business problems.

More from this Author

Follow Us