Is it possible to chat with an AWS Connect Agent using an external resource and Lambda?

0

I have a Lambda function that has the correct permissions for Connect to start a chat and the chat is not going to the flow. There is nothing in cloudwatch except the 200 response I provided below. I grabbed the ContactFlowID and the InstanceID from the "show additional information" menu in the Flow editor screen and I also have another automation that can trigger a phone call with the flow via lambda which works, but chat doesn't. Any ideas?

I have multiple use cases for this doing different things, but would like to start with just a basic "hello world" to get a POC built.

import boto3

connect_client = boto3.client('connect')

def lambda_handler(event, context):

    try:
        response = connect_client.start_chat_contact(
            ContactFlowId = 'myflowID',
            InstanceId= 'myinstanceID',
            ParticipantDetails={'DisplayName': 'Customer'},
            InitialMessage={
                'ContentType': 'text/plain',
                'Content': 'bruh'
            }
        )
        print("Chat contact started:", response)
    except Exception as e:
        print("Error starting chat contact:", e)
        raise e

    return {
        'statusCode': 200,
        'body': 'Chat contact initiated successfully'
    }

And here is the response..

Chat contact started: {'ResponseMetadata': {'RequestId': 'requestIDhere', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Wed, 08 Nov 2023 14:12:27 GMT', 'content-type': 'application/json', 'content-length': '787', 'connection': 'keep-alive', 'x-amzn-requestid': 'someimportantIDnumber', 'access-control-allow-origin': '*', 'access-control-allow-headers': 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token', 'x-amz-apigw-id': 'OMdlEGSblah=', 'access-control-allow-methods': 'GET,OPTIONS,POST', 'access-control-expose-headers': 'x-amzn-RequestId,x-amzn-ErrorType', 'x-amzn-trace-id': 'Root=1-somenumbersandletters'}, 'RetryAttempts': 0}, 'ContactId': 'contactIDhere', 'ParticipantId': 'participantIDhere', 'ParticipantToken': 'blahblahblahmytokenblahblah='}

Here is my test flow. Enter image description here

1개 답변
1
수락된 답변

Hi John,

While you successfully created the chat, participants must be added to the chat for it to route anywhere inside of Connect. This is documented on the StartChatContact API page and the CreateParticipantConnection API page.

A high level overview of the steps is available here: https://docs.aws.amazon.com/connect/latest/adminguide/chat-message-streaming.html

Happy building!

profile pictureAWS
전문가
답변함 6달 전
profile picture
전문가
검토됨 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠