2022-01-03

Export users and queues to CSV-file in Amazon Connect

I created 2 simple Lambda functions that allow exporting users and queues to CSV files.


1. Export users to CSV

How it works:

  • Uses Amazon Connect API to fetch all available information about users
  • Saves it in CSV format
  • Uploads CSV to S3 bucket

Here is the source code of my Lambda function (using Python 3.9)

Before running this script you need to edit the following values:

#Amazon Connect InstanceID 

instance_id="513ab265-dd50-476b-976c-0ce5fac49907" 

 #csv-file name 

csv_file='/tmp/amazon_connect_users__'+dt_string+'.csv' 

 #S3 bucket name 

s3_bucket='amazon-connect-export'

 

Here is output format:

  • id  - id of user
  • username - username
  • firstname
  • lastname
  • email
  • phonetype  -  phone type SOFT_PHONE / DESK_PHONE
  • autoaccept - auto answer True/False
  • acw_timeout - after call work timeout
  • desk_number - phone number for Deskphone
  • security_profiles - list of security profiles, example = Agent|QualityAnalyst|CallCenterManager
  • hierarchy_group_name - agent hierarchy
  • routing_profile_name - routing profile
  • routing_profile_concurrency - concurrency configuration for routing profile - using following format CHAT|TASK|VOICE  (example - 4|10|1)
  • routing_profile_outbound_queue_name - default outbound queue for routing profile
  • routing_profile_details_list  - detailed configuration of routing profile in the following format:
    • QueueName1|Priority1|Delay1|Channel_type1,...QueueNameN|PriorityN|DelayN|Channel_typeN
    • Example:Tech_support|1|0|VOICE;BasicQueue|1|0|CHAT;BasicQueue|1|0|TASK;BasicQueue|1|0|VOICE


You can run it from Lambda or from AWS CLI. 

Example:
  • aws lambda invoke --function-name exportUsersToCSV --invocation-type Event return.json

2. Export queues to CSV

How it works:

  • Uses Amazon Connect API to fetch all available information about queues
  • Saves it in CSV format
  • Uploads CSV to S3 bucket

Here is the source code of my Lambda function (using Python 3.9)

Before running this script you need to edit the following values:

#Amazon Connect InstanceID 

instance_id="513ab265-dd50-476b-976c-0ce5fac49907" 

 #csv-file name 

csv_file='/tmp/amazon_connect_queues__'+dt_string+'.csv' 

 #S3 bucket name 

s3_bucket='amazon-connect-export'

 

Here is the output format:

  • id  - queue id
  • name - queue name
  • desc - queue description
  • status - queue status ENABLED/DISABLED
  • hours - hours of operation
  • ob_callerid_name - Outbound caller ID name
  • ob_phonenumber - Outbound caller ID number
  • ob_flow - Outbound whisper flow (optional)


You can run it from Lambda or from AWS CLI. 

Example:
  • aws lambda invoke --function-name exportQueuesToCSV --invocation-type Event return.json


3 comments:

  1. Many thanks for this! It is very useful!

    ReplyDelete
  2. Hello Good Sir, I'm quite new on this. Do you know why I could receiving StatusCode 202?

    ReplyDelete