Coder
Coder

Reputation: 3262

How to connect the agent in the Amazon Connect in outbound call

I have a simple contact flow like below from which I trigger the call from Amazon Connect (claimed phone number in AWS Connect) to the end customer (real customer phone number):

enter image description here

Now I want to connect an agent in the Amazon Connect end.

When I trigger the following code, I need to trigger the call from the Amazon Connect (Customer Agent) to the end customer (Real customer phone number)

const AWS = require('aws-sdk');
AWS.config.update({ region: 'us-east-1' });

exports.handler = (event, context, callback) => {
    let connect = new AWS.Connect();

    const customerName = event.name;
    const customerPhoneNumber = event.number;
    const dayOfWeek = event.day;

    let params = {
        "InstanceId" : '12345l-abcd-1234-abcde-123456789bcde',
        "ContactFlowId" : '987654-lkjhgf-9875-abcde-poiuyt0987645',
        "SourcePhoneNumber" : '+1123456789',
        "DestinationPhoneNumber" : customerPhoneNumber,
        "Attributes" : {
            'name' : customerName,
            'dayOfWeek' : dayOfWeek
        }

    }

    connect.startOutboundVoiceContact(
        params, function (error, response){

            if(error) {
                console.log(error)
                callback("Error", null);
            } else
            {
                console.log('Initiated an outbound call with Contact Id ' + JSON.stringify(response.ContactId));
                callback(null, 'Success');
            }
        }
    );
};
  1. How to add the customer agent in the contact flow?
  2. Logging is not working (Not able to find any logs in CloudWatch AWS)
  3. Is my call recording added in the right section in contact flow?

Upvotes: 1

Views: 1135

Answers (1)

Aossey
Aossey

Reputation: 935

To connect the call to an agent, you need to add a “set working queue” block to set the call to route to a queue where you have available agents. After you set your queue, replace the “disconnect / hang up” block with a “transfer to queue” block. This will route the call to an available agent or queue the call if no agent is immediately available.

Recording will only occur for the portion of the call between the agent and the outside party, so you won’t see any recordings for calls that didn’t get connected to an agent. Since you have the “set recording behavior” block set to “customer and agent” in your flow already, you should get a recording file when the call gets connected to an agent with the steps above.

Upvotes: 1

Related Questions