- Newest
- Most votes
- Most comments
Hello,
Thank you for reaching out to us . I have implemented your code in my local with few more changes and could able to successfully initiate outbound calling. Please find the code below :
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;
let params = {
"InstanceId" : 'xxxxxxx-7f52-4d2f-992d-xxxxxxx',
"ContactFlowId" : 'xxxxxx-5afb-428e-bbae-xxxxxx',
"DestinationPhoneNumber" : customerPhoneNumber,
"SourcePhoneNumber" : "+1xxxxxxxx",
"Attributes" : {
'name' : customerName,
}
}
connect.startOutboundVoiceContact(
params, function (error, response){
if(error) {
console.log(error, error.stack)
callback("Error", null);
}
else
{
console.log('Initiated an outbound call with Contact Id ' + JSON.stringify(response.ContactId));
callback(null, 'Success');
}
}
);
}
Test Event - { "name": "Namratha",
"number": "+1xxxxxxxx" }
CLI Command. -
aws connect start-outbound-voice-contact --region us-east-1 --destination-phone-number +1xxxxxxxxxx --contact-flow-id 1b3xx98ab0-xxxxxx-428e-bbae-xxxxxxx --instance-id d56bce38-7f52-4d2f-xxxxx-xxxxxx --source-phone-number +1xxxxxxxxx
Destination number and source number needs to be provided to the command to execute outbound calling. Please refer to this document for more information on outbound calling [1] .
References:
Relevant content
- Accepted Answerasked 5 months ago
- asked 9 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago