How to auto dial your patients for reminders

You want your call center agents to spend time talking to customers. You don’t want them to spend time dialing numbers and waiting for rings – do you?

Here’s how you can autodial customers (or patients) from your AWS connect contact center. This allows you to leave a voicemail if the person does not pick up the call. If the person does pick up the call, then AWS Connect can automatically relay a very customized appointment reminder to them. E.g. “Hi John,. Your appointment is on Monday August 30th at 10:30 a. If you need to reschedule the appointment, please press 1. We look forward to seeing you on Monday August 30th at 10:30 a. Thank you and have a great day!”

AWS Connect makes it incredibly easy to create a contact flow that helps you achieve this.

Hopefully you have already set up your agents in AWS connect,  moved your IVR over to AWS Connect and have figured out how to help your agents send SMS from AWS Connect itself. 

Head over to the Contact Flows section and create a new Contact Flow. All you need is to set a working queue (which you have already done when you set up the IVR). Then, you add a “Get Customer Input”. Here, you are basically relaying the information you get from $.Attributes (you will pass that from another program).

Use SSML for this instead of using text to speech. E.g.

<speak>Hi $.Attributes.Name. Your appointment is on $.Attributes.DateTimeText. If you need to reschedule the appointment, please press 1. We look forward to seeing you on $.Attributes.DateTimeText. Thank you and have a great day!</speak>

Here, you are passing $.Attributes.Name and $.Attributes.DateTimeText from the script you write. Here’s a simple, sample script to use. You are going to get these things from your AWS instance

ContactFlowId=’xxx ‘, (you will find that in the URL of the contact flow itself

InstanceId=’xxxx, (you will find that in the URL of the contact flow itself

QueueId=’xxxx’,  (you will find that in the URL of the queue itself,

import boto3
import sys
import getopt


def main(argv):
    phoneNumber = ''
    name = ''
    dateTimeText = ''

    try:
        opts, args = getopt.getopt(argv, "hp:m:d:", ["phone=", "name=", "dateTimeText="])
    except getopt.GetoptError:
        print('call.py -p <phone_number_in_E.164_format> -m <callee_name> -d <date_time_in_text>')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print('call.py -p <phone_number_in_E.164_format> -m <callee_name> -d <date_time_in_text>')
            sys.exit()
        elif opt in ("-p", "--phone"):
            phoneNumber = arg
        elif opt in ("-m", "--name"):
            name = arg
        elif opt in ("-d", "--dateTimeText"):
            dateTimeText = arg

    # print('Destination Phone Number: ', phoneNumber)
    # print('Name: ', name)
    # print('DateTimeText: ', dateTimeText)

    boto3.setup_default_session(profile_name='default')

    client = boto3.client('connect')

    response = client.start_outbound_voice_contact(
        DestinationPhoneNumber=phoneNumber,
        ContactFlowId='xxxx,
        InstanceId='xxxx',
        QueueId='xxxx',
        Attributes={
            'Name': name,
	 'DateTimeText' : dateTimeText
        }
    )

    #print("Response: ", response)

if __name__ == "__main__":
    main(sys.argv[1:])

That’s it. After this you can call the python script from the command line. 

The script calls AWS Contact flow that you just created, speaks the inputs to the person your agent called. 

Most importantly, if the callee wants to reschedule the appointment, they can press 1 and be placed in a queue to speak to your call center agent.

You can take this to a much more sophisticated level.


Let’s say that your agents are not using a CRM (which they really should – even if it is a no-frills PRM like ours). Instead, your agents are using a spreadsheet to dial numbers.

Here’s how you can drive more efficiency from your callcenter.

Enhance the script above to something like this

boto3.setup_default_session(profile_name='default')

    client = boto3.client('connect')

    with open('data.txt', newline='') as csv_file:
        data = csv.reader(csv_file,delimiter=',')
        for row in data:
            response = client.start_outbound_voice_contact(
                ContactFlowId='xxxx,
                InstanceId='xxxx',
                QueueId='xxxx',
                DestinationPhoneNumber=row[2],
                Attributes={
                    'Name': row[0],
                    'DateTimeText' : row[1]
                }
            )

Ensure that your data.txt file has the following format (the +1 is super important)

Gregory, Monday August 31st at 8:30 AM,+11231231234
Donnie, Monday August 31st at 9 AM,+1231231235
Johnny, Monday August 31st at 9:30 AM,+1231231236
Mohammed, Monday August 31st at 10 AM,+1231231237
Asif, Monday August 31st at 10:30 AM,+1231231238

That’s it.. You will help your agents immensely by doing this.

Hope this helps!


References:

Code from this post


Learn more