Automate appointment reminders using Amazon Pinpoint and Amazon Connect
Missed appointments result in thousands of dollars in lost revenue per year across industries. No shows waste precious time for subject matter experts waiting for customers. Some businesses manually remind their customers before the appointments; however, this is inefficient, not scalable, and costs productivity and money.
An agentless outbound dialing campaign for appointment reminders is an efficient way to reduce no-shows by calling customers. Customers are given an option to confirm or reschedule the appointment. Consistent, specific, and personalized messaging improves customer retention.
This solution walks through deploying an agentless outbound campaign that places calls to remind customers of upcoming appointments. A campaign administrator uploads a calling list to Amazon S3 using a pre-defined comma-separated file/template. Amazon Pinpoint and Amazon Connect orchestrate outbound calls and save contact results for reporting using Amazon QuickSight. Customers can reschedule their appointments without the need for an agent using Amazon Lex.
In the preceding architecture, the following sequence of steps takes place for an outgoing contact:
- A campaign administrator uploads contact list to an Amazon S3 bucket.
- The contact list is processed and uploaded by AWS Lambda to Amazon DynamoDB and an Amazon Pinpoint segment.
- An Amazon Pinpoint journey processes the segment data using a custom channel by calling an AWS Lambda function to generate calls.
- AWS Lambda checks Amazon DynamoDB to verify that the phone number is not on the Do-Not-Call (DNC) list. It then calls using StartOutboundVoiceContact API.
- Amazon Connect contact flow uses Answering Machine Detection (AMD) for the next action.
- If you answer the call, you have the option to confirm your appointment, or reschedule the appointment.
- If you request an agent, you are placed in a queue for the next available agent.
- If you confirm the appointment, the call ends.
- If the call is answered by voicemail or answering machine, you hear a message with the appointment details.
- If you choose to change the appointment, an Amazon Lex chatbot handles processing of appointment rescheduling via self-service.
- Amazon Lex invokes a Lambda function to update appointment change details to Amazon DynamoDB.
- After the call is completed, Amazon Connect updates the Amazon DynamoDB table with the call outcome.
- Amazon DynamoDB maintains status of calls in the campaign.
- Amazon QuickSight provides dashboards for monitoring, and for historical analytics to business users.
For this blog, you should have the following prerequisites:
- An AWS account
- An Amazon Connect instance with High Volume Outbound Communications enabled. Refer to this blog to get started.
- Access to the following AWS services:
Step 1: Get Amazon Connect instance details
- Sign in to the AWS Management Console and open the Amazon Connect console.
- Select your Amazon Connect instance, and make a note of the instance id. This is the last part of the instance Amazon Resource Name (ARN) after the forward slash.
- Log in to your Amazon Connect instance.
- In the navigation pane, under Routing, choose Queues.
- Select BasicQueue, and choose Show additional queue information. Make a note of the Queue id of BasicQueue. This is the last part of the Queue ARN after the last forward slash.
- Download this sample contact flow.
- On the top-right drop-down, choose Import flow (beta). Select the Contact Flow downloaded in the previous step. Choose Import.In the navigation pane, under Routing, choose Contact flows, and choose Create contact flow.
- Choose Save to save the contact flow, and then Publish to publish the contact flow.
- On the top-left, select Show additional flow information. Make a note of the Contact flow id. This is the last part of the Contact flow ARN after the forward slash.
- If this is a new Connect instance, follow steps here to claim a phone number.
- Review the contact flow block, Check call progress.
- The contact flow branches off this Check call progress block based on answer detection:
- Call answered: Answered by a person.
- Voicemail (beep): Call ended in a voicemail and it detects a beep.
- Voicemail (no beep):
- Call ended in a voicemail, but it doesn’t detect a beep.
- Call ended in a voicemail, but the beep is unknown.
- Not detected: Could not detect whether there is voicemail.
- Error: Error encountered.
- In the navigation pane, choose High Volume Outbound Communications.
- In the top-right corner, choose Create Campaign.
- Under Campaign Details, enter a name for your campaign.
- Under Outbound configuration, select the contact flow you imported from the list of flows. Select Basic Queue for the queue.
- If no phone number is associated with Basic Queue, select an existing phone number.
- Choose Progressive under Dialer Configuration, and then set the bandwidth configuration to a percentage between 1-100%.
- Choose Save in the top-right corner.
- Open the campaign and make a note of the Campaign id from the end of the URL. Note: depending on when your Amazon Connect instance was created, your URL may be different than the following screenshot.
Step 2: Launch CloudFormation template
- Launch this CloudFormation template in the same Region as your Amazon Connect instance.
- Accept the default values and choose Next.
- Enter a stack name and enter the IDs noted earlier:
- Amazon Connect instance id,
- Amazon Connect queue id,
- Amazon Connect contact flow id,
- Outbound Campaign id, and choose Next.
- Choose Next.
- Choose Next, and scroll down to the bottom of the page.
- Acknowledge IAM resources creation, and choose Create stack. This will take a couple of minutes to provision the required resources.
- On your AWS Management Console, navigate to CloudFormation, Stacks, select AppointmentReminder, and choose Outputs. Make a note of the two bucket names for AppointmentfileBucket and ReportsDataBucket.
Step 3: Configure appointment reminder
Appointment Reminder bot
- Download sample Appointment Reminder Amazon Lex bot.
- Navigate to Amazon Lex in the AWS Management Console.
- On the Amazon Lex V2 console, choose Bots. If you’re in the Amazon Lex V1 console, click on Switch to the new Amazon Lex V2 console located in the left-hand menu.
- Choose Action, and then Import.
- In the Import bot screen, enter the Bot name as AppointmentReminder. For the Input file, select the zip file downloaded in Step 1.
- For Runtime role, select Create a new role with basic Amazon Lex permissions.
- As this bot is intended for demo, it’s not subject to COPPA, select No. Choose Import.
- Once the bot is successfully uploaded, select the AppointmentReminder bot. Choose Aliases in the navigation pane, and select TestBotAlias in the right pane.
- In the Alias: TestBotAlias screen, select English (US) Language.
- In the Lambda function – optional screen, choose the source as appointment-reminders-scheduling-lambda. This Lambda function is created by the CloudFormation template. For the Lambda function version or alias, choose $LATEST. Click Save.
- In the navigation pane, under English (US) language, Choose Intents, and choose Build at the bottom of the screen.
Associate Lambda function and Amazon Lex bot to Amazon Connect
- Navigate to your Amazon Connect instance, and select the instance alias.
- In the navigation pane, choose Contact flows.
- In the Amazon Lex section, choose your Region, and select the AppointmentReminders bot from the drop-down.
- Select TestBostAlias for Alias. Choose + Add Amazon Lex Bot.
- Scroll down to the AWS Lambda section, select appointment-reminders-status-update-lambda, and choose +Add Lambda function.
Update contact flow references
- Open the Amazon Connect console.
- In the navigation pane, under Routing, choose Contact flows.
- Select the Blog-AppointmentReminders_Main contact flow.
- On the Get customer input block, add the AppointmentReminders bot associated in the preceding step, along with TestBotAlias as Alias. Choose Save.
- On the Invoke AWS Lambda function block, from the dropdown and select the appointment-reminders-status-update-lambda function, and choose Save.
- Publish the Contact flow.
Step 4: Configure Amazon Pinpoint
- Download the sample segment file and use a text editor to replace the +1xxxxxxxxxx with a valid phone number in the Address field. Phone numbers must be in E.164 format.
- Note: If using MS Excel for editing the CSV. You must prefix the Address with a ‘ to keep the + symbol from dropping. The ‘ will not be saved as part of the file.
- Navigate to Amazon S3, and upload the csv file to the bucket name starting with appointmentreminders-calllistbucket.
- Open the Amazon Pinpoint console.
- In the navigation pane, choose All Projects. Select the appointment-reminders project that was created, and choose Segments.
- You should see two segments, one segment has the same name as your csv, and one named Appointment-Reminders-Dynamic.
- In the navigation pane, choose Journeys. Choose Create journey.
- When prompted with Welcome to journeys, click through, or close it.
- Enter a name for the journey in the top-left, then choose Set entry condition in the Journey entry block.
- Choose Add participants from a segment and select Appointment-Reminders-Dynamic from the Segments list. Under Specify how often… select Once every and set it to 1 hour. Select the Refresh on segment update box. Enter a description and select Save.
- Choose Add activity, choose Send through a custom channel from the list.
- Select the appointment-reminders-call-initiator-lambda from the list of Lambda functions. Add a description and choose Save.
- On the top right, choose Review. Verify that there are no errors, then click Next. Choose Mark as reviewed.
- Choose Publish.
- When the publishing is completed, choose Close. Your journey will start in 5 minutes. After the 5-minute wait, you should receive a call on the number that you entered into the csv.
For additional testing, upload a second csv with new phone numbers. Add one of the phone numbers to the do-not-call-list (DNC) DynamoDB table. Check that the number is in E.164 format. At the next scheduled refresh, the new numbers will enter the journey. You should not receive a call on the number entered into the DNC table.
Note: By default, you cannot use the same endpoint (phone number) over and over. If you must use the same number, change the journey settings for endpoints to re-enter the journey multiple times. Additional information on journeys is available in the Amazon Pinpoint User Guide.
Step 5: Configure reporting
Configure Amazon Athena
- Navigate to Amazon Athena console. Expand the menu in the navigation pane, and choose Workgroups.
- CloudFormation should have created an appointment-reminder-workgroup.
- On the navigation pane, choose Data sources, and choose Create data source.
- Select Amazon DynamoDB, and choose Next. For the Data source name, enter appointment-reminder-data-source.
- Choose Create Lambda function.
- The Athena DynamoDB Connector screen will open in a new browser tab.
- In the Application settings section, Update SpillBucket with the ReportsDataBucket name noted earlier, that starts with appointmentreminder-athenadatabucket.
- For the AthenaCatalogName, enter appointment-reminder-data-catalog-lambda.
- Acknowledge IAM resources creation, and choose Deploy.
- When the Lambda function creation is complete, switch back to the Athena tab in your browser.
- Select the Lambda function with name containing appointment-reminder-data-catalog-lambda from the drop-down. Select refresh if you do not see the Lambda function.
- Choose Next, and on the Review and Create screen, choose Create data source.
Configure Amazon QuickSight
- Navigate to Amazon QuickSight on your AWS Management Console.
- Choose the drop-down for the account on the top-right, and select Manage QuickSight.
- On the navigation pane, choose Security and permissions, and choose Manage.
- Uncheck and check the Amazon Athena selection.
- Choose Next on the pop-up. The next screen will show the list of buckets. Select the bucket name starting with appointmentreminder-athenabucket. Select Write permission for Athena Workgroup.
- Choose Lambda and select the Lambda function appointment-reminder-data-catalog-lambda. Choose Finish.
- A warning message for Athena Query Federation is displayed. Choose Save.
- On the top-left click on QuickSight, select Datasets in the navigation pane. Click New Dataset in the top-right.
- Select Athena as the data source.
- Enter a data source name, such as AppointmentReminders, and then select the appointment-reminders-workgroup Athena workgroup. Choose Validate and verify that the connection is working. Click Create data source.
- When prompted for the database, select the appointments-reminder-data-source you created in the preceding step. Select the appointment-reminders-data table and choose Select.
- On the Finish dataset creation screen, choose Directly query your data, then choose Visualize.
- After a minute, you should see the fields from the DynamoDB representing your appointment data.
- Create a report to monitor your campaign:
- Drag the CallStatus field onto the right side. Under Visual types, on the bottom-left corner, select the Donut chart.
- In the top-left navigation pane, under + Add, choose Add visual to add another chart.
- Drag another field, such as Timezone, into the second visualization. This will create a bar chart of the different time-zones from your campaign file.
- Choose Add > Add visual and position this visual following the other two.
- Under Visual types, choose the Table type.
- Choose one or more fields to show in the table and then resize the visual to show all the fields. The order you select the fields determines the initial order in the table.
- Change the order of fields in the table by selecting the field in the table, and then selecting the move arrows. Alternatively, if you select the table, drag and drop the fields in the Group By at the top to get the right order.
- When you are satisfied with the layout, choose Share > Publish Dashboard on the top-right. Set the name to Appointment Reminders Dashboard and choose Publish dashboard.
You’ve successfully configured and tested the appointment reminders outbound campaign.
- Navigate to Amazon S3, and select bucket names starting with appointmentreminder-athenadatabucket and appointmentreminder-calllistbucket.
- Choose each bucket and choose Empty.
- Confirm by typing permanently delete.
- Choose Empty.
- Navigate to AWS CloudFormation in your AWS Management Console.
- Select the AppointmentReminder stack, and choose Delete.
- On the confirmation dialog box, choose Delete stack.
- Navigate to Amazon Lex in your AWS Management Console.
- Choose AppointmentReminder bot.
- In Action drop-down, choose Delete.
- On confirmation dialog box, choose Delete.
- Navigate to Amazon Connect in your AWS Management Console.
- Select Contact flows on the navigation pane.
- Remove association with AWS Lambda and Amazon Lex.
- Navigate to Amazon Athena in your AWS Management Console.
- Choose Data sources from on the navigation pane.
- Select appointment-reminder-data-sources.
- From the Actions menu, select Delete.
- Navigate to Amazon QuickSight in your AWS Management Console.
- Select Dataset on the navigation pane.
- Select appointment-reminder-data.
- Choose Delete dataset.
- Select Dashboards on the navigation pane.
- Select the dots in the bottom right corner of your dashboard.
- Choose Delete.
- Choose Delete in the confirmation window.
- The Amazon Connect contact flow cannot be deleted from the console. The contact flow is reusable by modifying the contact flow blocks.
In this post, we implemented an agentless appointment reminder outbound campaign using the following steps:
- Deployed AWS resources using AWS CloudFormation.
- Stepped through configuring resources to create and run a campaign.
- Uploaded a pre-defined csv to Amazon S3 to start the campaign.
This automated outbound campaign for appointment reminders checked the campaign list against a ‘do not call’ list before making an outbound call. Your customers are able to confirm, or reschedule by speaking to an agent. You monitored the results of the calls on a dashboard in near real-time using Amazon QuickSight.
With Amazon Connect, you pay for what you use. There are no upfront payments, long-term commitments, or minimum monthly fees. The price metrics are detailed on Amazon Connect pricing.