AWS Connect API - StartTaskContact operation: InvalidRequestException:

673 Views Asked by At

I have tried the new AWS Connect API and have cut down the parameters to the minimum required but I still get the Invalid Exception and now at a loss. So any help welcome, I am sure it is obvious.

I am running the latest version of boto3 1.16.30

import boto3

client = boto3.client('connect') aws_instance = "arn:aws:connect:eu-west-2:xxxxxxx:instance/341e64ab-de99-4f3f-b8c4-f068d2a4284c"

def CreateTask(): # Obtain data from AWS Connect

try:
    response = client.start_task_contact(
        InstanceId = 'arn:aws:connect:eu-west-2:xxxxx:instance/341e64ab-de99-4f3f-b8c4-f068d2a4284c',
        ContactFlowId = 'c7f9557a-f8a3-4858-8187-fb3871787725',
        Name = 'Account Refer',
        Description = "Task referal",
        Attributes={
          'Account': 'AB100'
        },
        References={
            'string': {
                'Value': 'www.bbc.co.uk',
                'Type': 'URL'
            }
        }
    )
    print(response)

except client.exceptions.InvalidRequestException as Ex:
    print("Invalid Exception::", Ex)
   
    
except client.exceptions.InvalidRequestException as Ex:
    print("Invalid Request Exception", Ex)
    
except client.exceptions.InvalidParameterException as Ex:
    print("Invalid Exception", Ex)
    
except client.exceptions.ResourceNotFoundException as Ex:
    print("Resource Not Found Exception", Ex)
    
except client.exceptions.ThrottlingException as Ex:
    print("Throttling Exception", Ex)
    
except client.exceptions.ServiceQuotaExceededException as Ex:
    print("Service Quota Exceeded Exception", Ex)
    
except client.exceptions.InternalServiceException as Ex:
    print("Internak Service Exception", Ex)
    

if name == 'main':

CreateTask()
1

There are 1 best solutions below

0
On

The issue was using the ARN for the instance instead of the instance id, so beware there are some inconsistency with use of ARN/ID