I want to use the Amazon Connect StartOutboundVoiceContact API to program outbound calls to customers.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
Create an outbound contact flow
Important: To create a contact flow, log in to your Amazon Connect instance as a user that has sufficient permissions in the security profile.
Complete the following steps:
- Use your access URL to log in to your Amazon Connect instance. Use either https://alias.awsapps.com/connect/login or https://alias.awsapps.com/connect/login.
Note: Replace alias with your instance's alias.
- In the navigation pane, hover over Routing, and then choose Contact flows.
- On the Contact flows page, choose a template. Or, choose Create contact flow to design a contact flow from scratch.
- In the contact flow designer, for Enter a name, enter a name for your contact flow. For example, "Outbound calling."
- Choose Save.
For more information, see Use the flow designer in Amazon Connect to create flows.
Add a Play prompt block
To configure the audio prompt that customers hear during the call, use a Flow block in Amazon Connect: Play prompt.
Complete the following steps:
- In the contact flow designer, expand Interact.
- Drag and drop a Play prompt block onto the canvas.
- Choose the Play prompt block title.
- For Prompt, Choose Text to speech (Ad hoc).
- For Enter text, enter a message. For example, enter "Hello. This is a test call."
- Confirm that Interpret as is set to Text.
- Choose Save.
For more information, see Add text-to-speech to prompts in flow blocks in Amazon Polly and Use Amazon Connect contact attributes.
Add a Disconnect / hang up flow block
To automatically end the call after the outgoing message is played, use a Disconnect / hang up flow block.
Complete the following steps:
- Choose Terminate/Transfer.
- Drag and drop a Disconnect / hang up block onto the canvas to the right of the Play prompt block.
Connect the contact blocks
Connect all the connectors in your contact flow to a block in the following order: Entry point, Play prompt, and Disconnect / hang up.
You must connect all connectors to a block before you publish the contact flow.
Save and publish the contact flow
Complete the following steps:
- Choose Save to save a draft of the flow.
- Choose Publish to activate the flow immediately.
Get your Amazon Connect instance ID and contact flow ID
Complete the following steps:
- In the contact flow designer, expand Show additional flow information.
- Under ARN, copy the Amazon Resource Name (ARN). The contact flow ARN includes your Amazon Connect instance ID and your contact flow ID. These IDs are required to call the StartOutboundVoiceContact API.
Example contact flow ARN:
arn:aws:connect:region:123456789012:instance/12a34b56-7890-1234-cde5-6789f0a1b2c3/contact-flow/123a45b6-c7d8-9012-34e5-6fab789c012d
Confirm your IAM permissions for Amazon Connect
Attach an AWS Identity and Access Management (IAM) policy to your IAM role to call the connect:StartOutboundVoiceContact API.
Example JSON policy that provides the required permissions:
{ "Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "connect:StartOutboundVoiceContact",
"Resource": "arn:aws:connect:region:123456789012:instance/12a34b56-7890-1234-cde5-6789f0a1b2c3/contact/*"
}
]
}
Note: Replace the ARN with your Amazon Connect instance's ARN.
Call the StartOutboundVoiceContact API
Run the start-outbound-voice-contact AWS CLI command to call the StartOutboundVoiceContact API:
aws connect start-outbound-voice-contact --region awsRegion --destination-phone-number phoneNumber --contact-flow-id contactFlowId --instance-id instanceId --source-phone-number instancePhoneNumber
Note: Replace awsRegion with the AWS Region of your Amazon Connect instance. Replace phoneNumber with a recipient's phone number in E.164 format. Replace contactFlowId with your contact flow ID and instanceId with your Amazon Connect instance ID. Replace instancePhoneNumber with the phone number for your contact center in E.164 format.
The command response returns a ContactId when the action is successful, but you receive an error code if it is unsuccessful.
Related information
Create prompts in Amazon Connect
Set up outbound caller ID in Amazon Connect
Automating outbound calling to customers using Amazon Connect