How to auto dial from Amazon Connect

Autodial customers using Amazon Connect. Save time, efforts in making all necessary outbound calls. Simple steps to follow.

Categorized as Technology Tagged

This is a whole lot easier if you use a healthcare CRM and an automated communication solution like ours.

There are several kinds of autodialing that hospital call centers perform. We will look into each mode.

Autodialing numbers

This is the simplest case where hospital call centers are automating the manual task of punching in the phone numbers.

That’s about it.

The automation simply takes care of dialing the phone number and if the dialed phone number is a valid number, the call gets connected and everything proceeds as usual.

This is covered in some detail here Automating outbound calling to customers using Amazon Connect | Amazon Web Services.

My team and I have used this ourselves for

  1. automated appointment reminders,
  2. follow-up calls for patient no-shows
  3. Schedule appointments with no show patients
  4. Calls to patients that cancelled their appointments
  5. Calling patients that have fallen out of care
  6. a first-time contact initiated from an online one-click call button or “contact us form”
  7. Our community outreach cold calls.

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 Amazon 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!

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

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. 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 = ''
         opts, args = getopt.getopt(argv, "hp:m:d:", ["phone=", "name=", "dateTimeText="])
     except getopt.GetoptError:
         print(' -p <phone_number_in_E.164_format> -m <callee_name> -d <date_time_in_text>')
     for opt, arg in opts:
         if opt == '-h':
             print(' -p <phone_number_in_E.164_format> -m <callee_name> -d <date_time_in_text>')
         elif opt in ("-p", "--phone"):
             phoneNumber = arg
         elif opt in ("-m", "--name"):
             name = arg
         elif opt in ("-d", "--dateTimeText"):
             dateTimeText = arg
     client = boto3.client('connect')
     response = client.start_outbound_voice_contact(
             'Name': name,
 'DateTimeText' : dateTimeText
 if __name__ == "__main__":

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 called person 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 call center.

Enhance the script above to something like this

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(
   '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. You could even create a google sheet function to dial automatically from your google sheet by simply clicking on a button on each google sheet row.

( Code from this post