DescribeContact is returning undefined AgentInfo

0

I am using DescribeContact to retrieve the assigned agent id as suggested here, however AgentInfo is returning "undefined" despite there being an agent assigned. I've tried placing the lambda in both agent and customer whisper flows, and with using auto accept or manual accept, and the result is the same. Am I doing something wrong, or is this method not real time?

My code (simplified):


import { ConnectClient, DescribeContactCommand } from '@aws-sdk/client-connect';
export const handler = async(event) => {
    const client = new ConnectClient();
    
    var input = {
      ContactId: event['Details']['ContactData']['ContactId'], /* required */
      InstanceId: "XXXXX" /* required */
    };

    const command = new DescribeContactCommand(input);
    const response = await client.send(command);

    return response.Contact;
};

The returned response having undefined AgentInfo:

Contact: {
    AgentInfo: undefined,
    Arn: 'arn:aws:connect:us-east-1:657086911202:instance/XXXX/contact/9b57ea60-f114-4970-a7ed-557998bde650',
    Channel: 'VOICE',
    Description: undefined,
    DisconnectTimestamp: undefined,
    Id: '9b57ea60-f114-4970-a7ed-557998bde650',
    InitialContactId: undefined,
    InitiationMethod: 'INBOUND',
    InitiationTimestamp: 2023-06-22T13:52:14.336Z,
    LastUpdateTimestamp: 2023-06-22T13:53:52.008Z,
    Name: undefined,
    PreviousContactId: undefined,
    QueueInfo: {
      EnqueueTimestamp: 2023-06-22T13:53:36.994Z,
      Id: 'bd705363-373a-4483-bd94-b33297febf46'
    },
    ScheduledTimestamp: undefined
  }
evad
asked 10 months ago183 views
3 Answers
1

If I understand your ask correctly, you're calling a Lambda on one of the whisper flows before the customer and agent are connected to each other, yes? Is the Lambda successful after the connection is completed or after the call?

I haven't personally tested to confirm, but I'm thinking the agent won't show as assigned until the two parties are actually connected after the whispers play.

profile pictureAWS
answered 10 months ago
0

Yes that is exactly it, I am calling the lambda from the whisper flow. The lambda does successfully return the AgentInfo if it is ran during/after the call as opposed to in the whisper, however documentation says that the whisper flow runs after the agent has joined the call "A whisper flow is triggered after the agent accepts the contact (either auto-accept or manual accept)" which led me to believe that the agent info should be available at that point given the agent has accepted the call and is now the assigned agent. Is there another method similar to DescribeContact that can be used to retrieve the joined agent from within the whisper flow? Or alternatively, is there a way to call the lambda after the whisper flow finishes and the agent and caller are actually connected? My use case is to retrieve the assigned agent as early on as possible

evad
answered 10 months ago
0

Another piece of documentation hinted that the agent info is available in a contact attribute and indeed the username is available in the whisper flow, which is sufficient for me.

Thanks for the help.

evad
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions