Skip to main content

Secure Healthcare Scheduling with Amazon Pinpoint and TensorIoT

By Nicholas Burden, Sr. Technical Evangelist – TensorIoT
By Francisco Zamora, Contributing Writer

Connect with TensorIoT-2

Care Connectors Medical Group (CCMG) is a leading national healthcare service organization that allows patients to take advantage of in-home medical services at a fraction of the cost of standard outpatient medical visits.

Through a broad network of physicians, CCMG keeps patients up to date on their medical examinations and provides medical services without requiring office visits, a critical protective measure during the pandemic.

CCMG has established partnerships with some of the nation’s biggest insurance providers. CCMG assists insurance providers by reaching out to patients in order to get updates on their health and well-being, ensuring providers have up-to-date medical data.

Care Connectors also helps clients in achieving a higher completion rate for preventive care, including mammogram, colonoscopy, diabetic eye exam, neuropathy, and more.

In this post, we will explore how TensorIoT, an AWS Advanced Tier Services Partner specializing in cloud-native solutions for Internet of Things (IoT), artificial intelligence (AI), and chatbots, leveraged Amazon Pinpoint and other AWS services to give CCMG a HIPAA-compliant system capable of handling scheduling and routing for their clients.

The system helped CCMG to replace outdated cold calling methods, freeing up customer service agents to handle more complex customer issues, while improving overall patient engagement and appointment acceptance.

The Challenge

CCMG wanted an efficient system to optimize appointments scheduling and routing for their providers. They partnered with TensorIoT to drive higher engagement and acceptance rates, and to optimize routing for CCMG providers to help maximize the number of digital patient visits client doctors can perform in a day.

Another concern of CCMG is HIPAA compliance and strict regulations that govern health services. CCMG needed a solution that could safely and securely access the client’s private database server, and provide a secure user interface (UI) to prevent unauthorized users from accessing the mass SMS text messaging functionality.

The Solution

To overcome these challenges, TensorIoT incorporated secure Amazon Web Services (AWS) solutions that specifically addressed the needs of clients like CCMG.

TensorIoT development teams utilized a bastion host to enable the initial AWS Lambda function to reach into the private SQL database. This allows the UI to dynamically load user data from the database, as well as take CSV files and parse them to the main table, keeping patients’ personal health information secure and inaccessible to malicious agents.

The UI was created using React, leveraging Amazon Cognito for user management and AWS Amplify for user authentication. These services speed up development and ensure secure authorization.

Prior to seeking a solution from TensorIoT, CCMG’s primary method of communication was based on cold calls from their third-party call center service. To achieve their goal of a higher acceptance rate when engaging with patients, CCMG enlisted TensorIoT to create a solution to communicate with a large volume of patients through mass SMS and a variety of other channels.

TensorIoT development teams decided to leverage Amazon Pinpoint, a multi-channel communication service, to handle the mass SMS functionality with the ability to create custom campaigns with increased personalized content.

Amazon Pinpoint was particularly valuable for this project because it provides a flexible and scalable service for both outbound and inbound communications. Amazon Pinpoint is easy to set up, easy to use, and offers flexibility and scaling to adapt to any communication scenarios.

Through Amazon Pinpoint, CCMG can bridge the gap between patients and physicians through a comfortable and cost-efficient alternative to traditional patient engagement.

CCMG also assists their insurer clients in retrieving medical records for primary care physicians, hospitals, and other facilities to capture related diagnoses and current procedural terminology (CPT) codes.

This solution provides a higher retrieval rate and manages the prospective projects efficiently to provide increased visibility and updated data.


Figure 1 – Amazon Pinpoint features.

TensorIoT designed the application architecture with scaling in mind. This microservice was planned to be integrated with CCMG’s customer relationship management (CRM) system, and a single-page React app was designed to integrate with the backend services through a variety of endpoints exposed using Amazon API Gateway.

Hosting this static application on Amazon Simple Storage Service (Amazon S3) gave cost-efficient storage, and using Amazon CloudFront provided a more resilient serverless content distribution network.

The UI teams used a combination of Amazon Cognito and AWS Amplify to handle authorization and user management. Finally, Amazon Lex was used to build custom chatbot to guide users through scheduling or changing wellness visits via in-home, telemedicine, or mobile clinic appointments.

Adjust and Adapt

There are important design considerations when using Amazon Pinpoint. To preserve message attributes for personalization, development teams used Amazon DynamoDB to store custom message data using the CampaignId primary key associated with the respective Amazon Pinpoint CampaignId.

In combination with Amazon Simple Notification Service (Amazon SNS), responsive end users will be placed onto an SNS topic associated to the Amazon Pinpoint campaign and will enable two-way communication between patients and the custom Amazon Lex bot.


Figure 2 – CCMG application architecture.

As for the user interface, design teams worked together to create an elegant single-page application using React, a JavaScript library created by Facebook. Using this library, engineers were able to create custom components which hit the configured Amazon API Gateway endpoints created by the backend team.

Since the table of customers was known to be growing over time, testing and care was done to properly configure the API Gateway endpoints to allow batching. The team used additional batching configuration to conform the API call to meet the endpoint’s limits.

With the addition of React Virtualized, which aids in creating components for efficiently rendering large lists and tabular data, development teams were able to successfully squash the bug. As the frontend piece was being created, backend teams began to develop the infrastructure needed to compose the backend architecture.

Building the Solution

There are two major components to the backend: Amazon Pinpoint and Amazon Lex.

First, developers need to integrate the backend API’s with the React UI by testing the endpoints and making sure to validate the API call structure for the various calls needed to load the components with the necessary data.

The team also needed to test the Lambda function which dives into the client’s private SQL server to grab patient data and confirm it can only be accessed via the bastion host set up to securely connect. This is done by leveraging Lambda’s environment variables to store database credentials in order to keep those secret keys abstracted from the codebase.

Due to the database server being a SQL server, there were some hurdles to jump over when pulling specific patient data derived from a variety of filters coming from the UI. To successfully apply the multiple filters which agents could search by, engineers had to join a number of nested tables in order to properly load the table component with the correct patient data.

Each campaign can differ in business objectives, but this method of communication is a self-service way of managing healthcare appointments. The approach decreases the load of calls coming to CCMG’s primary call center, and frees up call agents to assist patients who may have trouble with technology.

This solution was built to increase communication between CCMG and their target audience, providing an elegant way to publish information to a mass amount of end users.

With the ability to select up to 5,000 users to send custom campaigns, in addition to batching the number of users to load on the table, there needed to be some configuration to successfully initiate these engagements through Amazon Pinpoint.

To store “message context” and give the backend services access, the designers used an interim Amazon DynamoDB table, saving the row using the primary key: ContextId – associated with the message ID used to send that individual message; and composite key: UserId – associated with the user’s phone number.

Since the Amazon Pinpoint MessageId was unique to that message, and the user’s phone number is unique to that user, backend engineers created this DynamoDB table to persist the custom message data.

Before initiating this conversation, there’s another Lambda that formats the messages before being stored and injects the user’s data into the custom message; such as: ‘Hello {firstName} {lastName}, …’ This creates a more personalized approach to encourage the patient to engage with the Amazon Lex bot.


Figure 3 – Amazon Pinpoint app dashboard – custom message configuration.

Amazon Pinpoint in Action

Amazon Pinpoint allows Care Connectors to run targeted campaigns in their CRM. It helps them understand user behavior, define which users to target, determine which messages to send, schedule the best time to deliver the messages, and then track the results of batch informational messaging.

The ability to view the campaign results and engagement is vital to iterating and improving processes for a higher conversion rate.

Using Amazon Lex and its deep learning functionalities gave TensorIoT the ability to create a scalable service capable of directly interacting with the target audience. As the app converses with patients, Amazon Lex manages dialog and uses APIs to capture valuable user data.

Amazon Pinpoint gives a secure way for users to opt out of messages, which is necessary when working with cell phone service providers. The Amazon SNS topic associated with the SMS sending origination number is set as an event to invoke and send any replies through to the Amazon Lex bot.

If a user replies with interest, that event is sent from the user to the long code used to text the user or Amazon Pinpoint application, then to the SNS topic, and lastly forwarded to the chatbot.

Amazon Lex provides an intelligent set of APIs used to understand the context of the user’s input or text, guiding the user’s conversation to an intent which Amazon Lex feels is the most accurate (such as make an appointment, change appointment, or find out more).

With Amazon Lex, the service can handle multiple concurrent dialogs at the same time, persisting session data and slot values through specific API calls. This enables developers to guide the conversation or update values and attributes, and the natural language processing (NLP) service allows Amazon Pinpoint to learn which approaches work best, providing a more successful chatbot experience.


Figure 4 – Key AWS products.


Testing the Amazon Lex bot is vital to providing a successful user experience every time. Each engagement is an opportunity to help a patient improve their health by increasing the accessibility to healthcare services by certified healthcare professionals.

In order to ensure a great customer experience, engineers began to test the Amazon Lex bot by testing happy and sad paths, making sure to fail gracefully if a service is out on vacation.

One benefit of using Amazon Lex is that you can use the set amount of utterances and intents used when creating a bot to develop a custom suite of integration tests. This provides a more accurate Amazon Lex bot by making sure all paths are capable of being routed successfully and confirming that API’s work from the chatbot’s dialog and fulfillment code hooks.

TensorIoT used the post text API to verify predicted outcomes and event responses. Once the Amazon Lex bot is tested, engineers can test the complete system, checking UI functionality, APIs, and Amazon Lex bot accuracy from a user’s perspective.

By enabling Amazon CloudWatch logs, engineers can see all interactions and debug if any errors occur. These logs are the source of truth when testing serverless applications, as well as for being able to test your chatbot in development through the AWS Management Console.

End-to-end tests are used to ensure all user stories are able to be successfully handled. Developers only need to confirm all business requirements are met, and remember to upgrade the Amazon Pinpoint messaging limit when going live.


Amazon Pinpoint allows businesses to effectively communicate with their customers and derive data from previous campaigns to improve future engagements. The TensorIoT solution detailed in this post helps Care Connectors Medical Group (CCMG) increase their patient conversion rate and provides an easy-to-use alternative for scheduling in-home healthcare appointments.

With the help of Amazon Lex, this service provides scalability while saving CCMG resources, and provides a smooth and intelligent system ready to handle any number of patients who need assistance scheduling services. Lean and effective, the dialogue script is versatile enough to handle a variety of tasks while reporting the user’s interactions.

Although this solution has been launched, the chatbot experience is an iterative process that benefits from continuous involvement. Amazon Pinpoint is a service that provides feedback that can be analyzed and used to refine the Amazon Lex bot structure through adding an intent or two.

With help from TensorIoT and AWS, CCMG now has more intelligent solutions that enables better engagement with patients and improved quality of services for their customers.

The content and opinions in this blog are those of the third-party author and AWS is not responsible for the content or accuracy of this post.


TensorIoT – AWS Partner Spotlight

TensorIoT is an AWS Partner specializing in cloud-native solutions for Internet of Things (IoT), artificial intelligence (AI), and chatbots.

Contact TensorIoT | Partner Overview | AWS Marketplace