- Newest
- Most votes
- Most comments
An IdempotencyException occurs when attempting to create an entity that already exists [1]. To resolve this issue, you should ensure that you are not trying to create duplicate outbound voice contacts with the same parameters. When using the StartOutboundVoiceContact API, the operation has a 60-second dialing timeout, and if the call is not connected within this timeframe, it will fail [1].
To verify if your API request is reaching Amazon Connect successfully, you can check the AWS CloudTrail events on the CloudTrail console for the StartOutboundVoiceContact API event name. If you encounter issues with outbound calls, you can use the describe-contact command to determine whether the call was successful for a specific contact ID [2].
Best Practices:
- Always use unique ClientTokens for each call. It isn't required parameter so you can leave it to the AWS SDK to generate one.
- If you decide to provide a client token, store and track used ClientTokens if needed.
- Implement proper error handling
- Consider implementing a retry mechanism
- Use meaningful ClientToken patterns (e.g., including timestamp or request ID)
Additional Considerations:
Example with more robust token generation
def generate_client_token(prefix="call"):
timestamp = int(time.time())
unique_id = str(uuid.uuid4())[:8]
return f"{prefix}-{timestamp}-{unique_id}"
Error Handling Pattern:
def safe_outbound_call(connect_client, params):
try:
return connect_client.start_outbound_voice_contact(**params)
except connect_client.exceptions.IdempotencyException as e:
logger.warning(f"Idempotency exception: {str(e)}")
# Generate new token and retry
params['ClientToken'] = generate_client_token()
return connect_client.start_outbound_voice_contact(**params)
except ClientError as e:
logger.error(f"AWS error: {str(e)}")
raise
Remember that ClientTokens must be unique within the 7-day window. If you need to make the same call again within this period, you must use a different ClientToken.
This approach ensures reliable outbound calling while maintaining idempotency protection.
References:
[1] StartOutboundVoiceContact https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundVoiceContact.html
[2] How do I troubleshoot issues with outbound campaigns in Amazon Connect? https://repost.aws/knowledge-center/connect-troubleshoot-outbound-campaigns
Relevant content
- AWS OFFICIALUpdated 2 years ago
