I am currently working on a project, one of the elements of which is Amazon Connect. So far I have the function of triggering the connection locally on the disk and according to the documentation I am using the following code.
const AWS = require('aws-sdk');
AWS.config.loadFromPath('./configuration/keys/key-aws.json');
exports.makeCall = (number) => {
let connect = new AWS.Connect();
var params = {
InstanceId: 'xxxxxx',
ContactFlowId: 'xxxxxx',
SourcePhoneNumber: 'xxxxxx',
DestinationPhoneNumber: number,
Attributes: {},
};
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));
}
}
);
};
My questions about this:
Thanks in advance for your help!
The other option involves using the kinesis data stream and monitoring that to track the contact and calling the lamba when the contact completes. See https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html
I would be writing the contactid to a dynamodb and using that in the lambda that watches the kinesis stream.
Do you mean from within a contact flow? If so then not directly, you can only call lambdas, but the lambda could call the external source.
Sure, either using the DecribeContact call as above Or, if you send the outbound call to a queue that only has a single agent associated with it (via a Routing Profile or using an Agent Queue) the you could use GetCurrentMetricData and check the AGENTS_AVAILABLE and CONTACTS_IN_QUEUE metrics to decide whether to create a new call.