Guides

Mar 2, 2025

Automatically respond to patient inquiries with AI

Albert Mao

Co-Founder

Transform your organization with AI

Discover how VectorShift can automate workflows with our Secure AI plarform.

Use Case Overview

Hospitals today are grappling with the challenge of managing a high volume of patient communications across channels. One such channel is patient emails. A high volume of such queries burdens healthcare professionals but answering them effectively is essential to delivering quality patient care. 

These emails often involve questions around 1) hospital policies and logistics, 2) appointment scheduling, 3) billing and insurance, and 4) patient records and documentation.

Earlier this year, VectorShift helped a national primary care provider (30+ providers) deploy a HIPPA compliant Email Automation workflow automation that automatically drafts up responses to incoming emails based on a knowledge base of hospital policies and previous email responses. With the drafts, healthcare professionals can quickly review the drafts and make any necessary adjustments before sending them out. All-in, the automation saves hospital staff ~80% of the time in responding to patient inquiries. 

In this article, we walkthrough how to build an AI email automation workflow using VectorShift. 

Building Steps

  1. Build a knowledge base of relevant documents that can be useful as context for responding to the emails 

    • Create a knowledge base.

    • Add relevant documents to the knowledge base.

  2. Build the workflow automation

    • Utilize a “trigger”, a node that signifies to run a workflow when “something” happens. In this case, we want the email automation workflow to run whenever a new email from a patient arrives. 

    • The workflow will query a knowledge base, returning relevant information that can be useful in responding to the email. 

    • Based on the context from the knowledge base, have a LLM generate a draft email response. 

    • Save the generated email as an Email draft, ready to be reviewed and sent out. 

The Pipeline Design Overview

Build Hospital’s Knowledge Base

We will build a knowledge base that can provide relevant context for responding to emails. Any information that can be useful such as patient guides, policies, and previous emails can all be used here. 

Step 1: Go to Knowledge, and click “New” on the top right. Give a name to the knowledge base then click “Create”.

Step 2: Go to “Add Document” on the top-right, click “Choose / Upload Files” >> then click “Browse Files”.

Step 3: After selecting the documents, click on “Finish”. You will then see a confirmation screen of the documents that have been successfully added. 

Designing the Workflow

Google Trigger

Step 1: Go to the “Gmail” trigger node and click on “New Email”. Then click on “Sign in with Google”.

A trigger designates that a pipeline should run when “something” happens, in this case, when a new email arrives in an inbox. 

Step 2: Click on Continue and check all of the permissions. Then click “Continue” again.

Step 3: Click on “Select Mailbox”, then select “INBOX” (you can also choose another mailbox as well, “IMPORTANT” for example). Then, click “Confirm Selection” on the bottom.

This designates that when a new email arrives in the inbox, the workflow will be triggered. 

Knowledge Base

Step 1: Query the knowledge base so we search for relevant information to the contents of the email. This is so that we can ensure a relevant response to whatever the patient is asking.

To query the knowledge base based on the email, we have to pass the body of the email to the knowledge base.

To reference specific data fields from other nodes, you have to do two things:

  1. Connect the two nodes.

  2. Reference the desired data using a variable.

Variables in VectorShift all have the same structure: 

{{[Node name].[OutputField]}}

Each node in VectorShift has a name at the top of each node (e.g., gmail_0) and output field(s), which are found in the right-hand pane of each node (e.g., contents_of_email refers to the body of the email received).

You can also create variables by typing “{{“ in any text field, which opens the variable builder. To reference the body of the email, you call the variable: 

{{gmail_0.contents_of_email}}

Lets walk through how to do this step by step for this use case: 

Connect the “Gmail Trigger”, to the “Knowledge Base”. On the knowledge base reader node, in the “Search Query” field, type “{{” opening the variable builder. The first step of the variable builder is to select the node you want to reference. Here we select the gmail node, “gmail_0”.

Step 2: After selecting the gmail node, we want to select which field to reference within the Gmail node. We want the email body, or contents_of_email. 

LLM Node

We now need to use a LLM node to generate an email response, using context from the knowledge base. 

Connect the Knowledge Base node and Gmail Trigger to the LLM node. We are using Anthropic 3.7 Sonnet here but VectorShift is LLM agnostic - you can use whatever LLM you want!  

The LLM node has two fields: “System (Instructions)” and “Prompt”.

“System (Instructions)” defines how you want the LLM to behave. You can use the template below:

You are an email drafter to help customer service reply to patient's inquiries.Your job is to answer the patient's question using Context to formulate the answerGenerate a professional email draft to reply to the question based on contextOnly write the email draft and nothing else (not even the subject - only write the body of the email)

Within the “Prompt”, you can pass data from other nodes. Use the prompt below to:

Question: {{gmail_0.contents_of_email}}Context:{{knowledge_base_0.chunks}}

Gmail Integration

Finally, we need to save the drafted email under “drafts” within Gmail. 

Step 1: Take a “Gmail” node and choose “Draft Reply” as the action. Then Click “Next”. 

Step 2: Connect the “Anthropic” LLM node and “Gmail Trigger” node to Gmail Integration. Fill each field accordingly:

  • “To” Field: {{gmail_0.sender_email}}. You want to send the email to the person who originally sent it. Therefore, the “To” field is the sender email. 

  • “Body” Field: {{anthropic_0.response}}. This will fill the body of email with the generated text from the LLM.

  • “Email Id” Field: {{gmail_0.email_id}}. This allows the node to recognize which email chain to reply to. This ensures responses will be in the same thread. 

Deploying the Pipeline

The last thing you need to do is to deploy the pipeline. This allows the pipeline to run as automation, which means each new email will trigger the pipeline to draft a reply automatically. First, ensure that “Enable Automation” is turned to “On” on the trigger node. Then, click “Deploy Changes” on the top right and click “Deploy”.

Expected Result

The image below shows an example of a patient’s email in an “Inbox”. Then we can check on “Draft” to see the draft reply.

Conclusion

This patient inquiry automations in healthcare can significantly improve patient communication and operational efficiency. By implementing the pipeline above and addressing key considerations, hospitals can leverage t AI to enhance their patient service while maintaining high standards of care and compliance.

Curious about the potential automations? Contact us to learn how AI can improve your patient experience.

Albert Mao

Co-Founder

Albert Mao is a co-founder of VectorShift, a no-code AI automation platform and holds a BA in Statistics from Harvard. Previously, he worked at McKinsey & Company, helping Fortune 500 firms with digital transformation and go-to-market strategies.


© 2023 VectorShift, Inc. All Rights Reserved.