- Newest
- Most votes
- Most comments
we have an example please update accordingly
and before Please refer to the following documentation about GetContactAttributes
https://docs.aws.amazon.com/connect/latest/APIReference/API_GetContactAttributes.html
import boto3
connect_client = boto3.client('connect')
# Replace contact_id with the ID of your contact
response = connect_client.get_contact_attributes(
InitialContactId='contact_id'
)
# Extract the status attribute from the response
status = response['Attributes']['status']
# Do something based on the status
if status == 'handled':
# Handle the task
elif status == 'expired':
# The task has expired
as a workaround
When creating a task, you can set custom attributes for the task. Add an attribute (e.g., "status") to the task with an initial value (e.g., "pending"). This way, you will be able to track the status of the task.
response = connect_client.start_task_contact(
InstanceId='your_instance_id',
ContactFlowId='your_contact_flow_id',
Name='your_task_name',
Attributes={
'status': 'pending'
}
)
Inside the contact flow associated with the task, use a Lambda function or an Amazon Connect API to update the "status" attribute based on the task's progress (e.g., "in_progress", "completed", "failed", etc.).
To query the status of a task from your external application, you can use the get_contact_attributes API call as mentioned in my previous response. You can then use the "status" attribute value to determine the current status of the task.
I'm aware when a task expires we can trigger a contact flow, and set an attribute like you suggest
From: https://docs.aws.amazon.com/connect/latest/adminguide/set-disconnect-flow.html
A disconnect event is when:
- A chat, or task is disconnected.
- A task is disconnected as a result of a flow action.
- A task expires.
I appreciate for (2) we could set an attribute saying it's a status = "disconnected due to something in the flow" but I cannot see how we'd discriminate between (1) and (3)
Relevant content
- asked a year ago
- asked 2 years ago
- asked 10 months ago
- asked 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thanks for the info . Essentially I have an external app wants to query the status of a a task that has been submitted in the past. The attribute status you have provided is not available for tasks . I can only see it available for cases? From where I cant get the proper status for tasks. then i can add it as an attribute
Sorry i have added another answer for this one