With COVID-19 continuing to impact citizens globally, many individuals have been required to shelter-in-place to reduce the spread of the virus. While this has reduced the exposure risk for COVID-19, it has created social- and health-related challenges for individuals, such as access to healthy food, social service supports, and healthcare.
To lessen the strain on New York City’s overburdened hospital emergency departments and intensive care units, leaders from social services, healthcare, and technology organizations came together in March to create the NYC COVID-19 Rapid Response Coalition. The coalition extends treatment and services to high risk, chronically ill, and underserved New Yorkers in need of at-home care and services.
One of the many organizations in the coalition is MetroPlus Health Plan (MetroPlusHealth), which insures over half a million adults and children across New York City. Early in the COVID-19 crisis, the MetroPlusHealth team identified approximately 85,000 at-risk individuals (e.g., comorbid heart or lung disease, or immunocompromised) who would require additional support services while sheltering in place. In order to engage and address the needs of this high-risk population, MetroPlusHealth needed to quickly develop capabilities to connect each individual with the right resource to ensure their specific needs were met.
MetroPlusHealth wanted to focus on several areas; emotional support, access to a medical provider, pharmacy refills, and challenges with accessing food and unemployment support. The team worked closely with their partners, including a local data-driven Community-Based Organization (CBO) called AIRnyc, which deploys Community Health Workers to help people navigate the health and social care landscape. Together, the organizations worked to identify resources for each of these issues, leveraging both existing support systems like the NYC COVID hotline, the COVID Emotional Wellness line, MetroPlusHealth’s telehealth vendor, and the staff from the MetroPlusHealth’s pharmacy customer phone lines.
AIRnyc, MetroPlusHealth, AWS, and a pro bono team from Bain & Company worked iteratively to design, deploy, and refine the engagement process over a three-week period, which included SMS campaigns that reached up to 10,000 members a day, connecting them to available resources. After the initial pilot, MetroPlusHealth care managers began leveraging a CBO referral platform, called NOW POW, and existing MetroPlusHealth contracts and relationships with food delivery services, including God’s Love We Deliver. As a result, thousands of at-risk individuals were connected with necessary services while reducing their exposure to COVID-19.
MetroPlusHealth’s Deputy Chief Medical Officer Amanda Parsons, MD, MBA states, “We are always concerned about the health and well-being of all our members, but when a crisis like COVID-19 hits, we know the most vulnerable and high-risk are disproportionately impacted. In a matter of days, we were able to deploy a solution that enabled us to reach individuals at high risk for poor COVID-19 outcomes and identify, and address, their health and social risks during this crisis.”
To connect with New Yorkers in need, MetroPlusHealth worked with AWS Professional Services and solutions architects to build a SMS-based chatbot solution. The chatbot leverages several AWS services including Amazon Pinpoint, Amazon DynamoDB, Amazon Connect, Amazon Lex, and AWS Lambda. Amazon Pinpoint, a highly scalable and globally distributed service helped MetroPlusHealth reach out to tens of thousands of individuals by SMS while Amazon Connect enabled a two-way connection with the wellness support executive without requiring the user to dial a phone number. Amazon Lex, which uses the same deep learning technologies as Alexa, works as a foundation for the conversational interface. Amazon DynamoDB, a high performance and fully managed NoSQL database service is used to store user responses while AWS Lambda, a serverless compute service enabled the solution to scale without worrying about the computational needs when running large campaigns.
This blog post provides step-by-step guidance on how to deploy a similar solution for your organization to support outreach and engagement with your communities and populations. Additionally, this blog post explains how to add other languages, such as Spanish, to the chatbot to engage with a more diverse population while complying with government regulations and guidelines within the US and internationally.
Process flows and architecture
AWS allows services to be integrated creating a flexible solution that can meet your needs. In this use case, we built upon a previous architecture for clinically validated conversational agents by introducing a flexible way to change the dialog of the Amazon Lex chatbot and integrate Amazon Connect to allow individuals to be connected with any Contact Center.
Building upon that use case, Amazon Pinpoint was incorporated into the architecture along with the other services including Amazon Lex, Amazon DynamoDB, Amazon S3, Amazon Connect, and AWS Lambda. Business stakeholders within an organization can work with administrators to create a scripted dialog flow and upload them as comma-separated values (CSV) files. The questions are then ingested into a DynamoDB table where the chatbot can read relevant questions based on responses from individual users. Using Amazon Pinpoint, an outreach campaign initiates the interaction with individuals, with the goal of informing them about available resources. The service can then facilitate a connection to a specific contact center, where an agent is available to assist with their needs. This approach reduces the time and effort required by individual contact center employees, who would otherwise be required to reach out manually to connect those in need with available resources.
This section explains the step-by-step guide on how to deploy the chatbot solution.
Step 1: Set up the Amazon Pinpoint project
- Navigate to the Amazon Pinpoint from the Services tab in AWS Management Console and create a new Amazon Pinpoint project.
- Click the configure button under “SMS and voice” to enable the SMS channel for the project and set the Default message type to “Transactional.” Refer to the documentation to learn more.
- Next step is to request the long code (phone number) which will be used by Amazon Pinpoint to send the text messages. Choose Advanced configurations – optional and select Request long codes. You can find more information here.
- Since the chatbot will be require to send and receive messages, enable two-way SMS feature for the long code. Click on the Long Code number and select the checkbox next to “Enable two-way SMS.” Under Incoming message destination, choose Create a new SNS topic, and name it “SMSChatBotSNSTopic.” For more information about setting up two-way SMS, click here for documentation.
- Copy the Project ID from the Amazon Pinpoint console and save it in a notepad. You will need it later.
Step 2: Set up the questions template
- Download the file SMSChatBotQuestions.csv and update the questions as per your requirements and endpoints.
- Notice that the values in “When yes” and “When no” columns controls the conversation flow.
- If the multi-lingual support is required, add the translated questions at the end of the English ones. As shown in the template, if the user choose Spanish language as a preferred language (question 2), the control is passed to Spanish language questions.
Quick tip: Ensure that the CSV is saved in the UTF-8 format.
Step 3: Deploy code and services
As the above architecture suggests, the chatbot uses several AWS services – Amazon Pinpoint, Amazon S3, Amazon DynamoDB, Amazon Lex and, AWS Lambda. This post leverages AWS CloudFormation to make the deployment easier.
- Download the code artifacts required for this solution. Now upload the files (S3EventTriggerDDBUpdate.zip, SMS-Chatbot-Pinpoint.zip, SMS-ChatBot-CodeHook.zip) to a S3 bucket in your AWS account. You can use an existing or create a new one. For example, I have created a code bucket named “sms-chatbot-artifacts.”
- Login to your AWS account and click the following button to launch an AWS CloudFormation stack in us-east-1, and choose Next.
- On the “Specify stack details” screen all the information will be pre-populated as shown in the screenshot below. Click Next.
- Settings on the Configure stack options page are optional, click Next.
- Select all acknowledgment boxes, and click Create Stack. It will take couple of minutes for the AWS CloudFormation to deploy all the resources. Once the Stack is successfully created, on the Resources page, save the Physical ID of LexBotCodeHookFunction.
- Go to TemplateBucket by choosing Physical ID of TemplateBucket and upload the questions CSV file SMSChatBotQuestions.csv file downloaded in Step 2 to the S3 bucket. Refer to this documentation if you need help with S3 console.
- Open the SMS-Chatbot-Pinpoint Lambda and click “Add Trigger” button. In the Trigger configuration, select SNS and then select “SMSChatBotSNSTopic.” You created this SNS topic during the Amazon Pinpoint project setup in Step 1.
- Click the “Edit” button next to Environment Variables and update the value for “PinpointApplicationId” variable. You saved the Project ID in Step 1.
Step 4: Set up Amazon Lex chatbot
- Next step is to set up an Amazon Lex chatbot. Download the zip archive file. From the Services menu, navigate to the Amazon Lex console. Click the Actions button and select Import and choose LexSMSChatBot.zip from your computer. If you need more information, check the documentation on Importing in Amazon Lex Format.
- Click on SMSChatBot to Edit the bot. Click on the first intent name and select SMS-ChatBot-CodeHook Lambda function drop-down within the dialog and fulfillment sections. Repeat this for all the intents in the bot. For Version or alias of code hook, choose Latest. For each intent:
- In Lambda initialization and validation (dialog code hook), select Initialization and validation code hook and select the Lambda.
- In Fulfillment (fulfillment code hook), select AWS Lambda function and select the Lambda. Don’t forget to select Save after making the changes for each intent.
- Choose Build to start the Amazon Lex chatbot building process. After build was successful, you can test the chatbot by choosing Test Chatbot bar on the right side.
- Choose Publish and provide “smsBot” as an alias for your bot.
- You can test the bot using the Test Chatbot section on the right.
Step 5: Set up two-way connect
The two-way connect feature can be helpful if your conversational flow requires user to contact a call center or other helpline number. It leverages Amazon Connect to connect user to a phone number. This feature is optional and you can skip this section if don’t need a two-way connect.
Here are the setup steps:
- In the SMSChatBotQuestions.csv file, set the “Question Type” to “Transfer” for the question that will connect users phone to the helpline number. Upload the file back to the S3 bucket.
- Download this Connect Flow. You will need this after later in this setup.
- Navigate to Amazon Connect console and create an Amazon Connect instance in the US East (N. Virginia) Region. Next you need to claim a phone number for the instance. For more information, see Getting Started with Amazon Connect.
- In Amazon Connect Console, login to your Connect Instant. In left side bar, choose Routing, Contact flows. Then choose Create Contact Flow.
- Next choose “Import flow(beta)” and import the Connect Flow.
- Choose Save and then Publish.
- Expand the “Show additional flow information” and copy the Connect Instance Id and Contact Flow Id in a notepad. Now edit the Environment Variables in “SMS-ChatBot-CodeHook” Lambda with Connect information as shown below.
The solution is now deployed and you can test the bot by sending “Hi” to the phone number you provisioned using Amazon Pinpoint.
During this unprecedented crisis, technology and tools like the SMS chatbot can provide healthcare organizations like MetroPlusHealth with the ability to engage with their members, patients, and at-risk communities in a scalable manner. Enabling solutions such as the one described in this blog enables organizations to scale their engagement channels for outreach, identify critical needs across the population, and connect individuals to organizations that can help them address their health or social needs such as access to healthy foods or mental health services. Although this post is centered around the current COVID-19 pandemic, this solution can be used to implement an outbound SMS engagement strategy for other scenarios and can be mapped to a broader set of opportunities for healthcare payers and providers to address condition management, wellness campaigns, or population health management.