1

I am working on Amazon Connect application. I am using lambda for handling backend data. My requirement is to change agent status from lambda call using AWS SDK/Stream API. I know we can do this from Amazon Connect stream api via CCP. But in my case, it needs to be done from lambda call. I checked documentation of AWS Connect SDK but there is not direct method available for changing Agent state.

Kindly suggest.

Thanks, gans

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
gans
  • 51
  • 1
  • 7

2 Answers2

1

You can directly set the agent state using the Amazon Connect Streams API:

var state = agent.getAgentStates()[0];
agent.setState(state, {
   success: function() { /* ... */ },
   failure: function(err) { /* ... */ }
});

Reference: https://github.com/amazon-connect/amazon-connect-streams/blob/master/Documentation.md#agent-api

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
  • yes, but in my case, requirement is different. I need to set from lambda instead of Amazon Connect stream API. We are not using CCP panel so we can not use stream api – gans Jun 18 '20 at 11:01
0

The April 2022 Connect release has added an API call to do this finally!

There is now a PutUserStatus operation that will update a given agents status.

The call to the operation in javascript is:

const AWS = require('aws-sdk');
const connect = new AWS.Connect(); 

let params = {
  AgentStatusId: 'STRING_VALUE', /* required */
  InstanceId: 'STRING_VALUE', /* required */
  UserId: 'STRING_VALUE' /* required */
};

connect.putUserStatus(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

where:

UserId is the guid identifier of the user.

InstanceId is the guid identifier of the Amazon Connect instance.

AgentStatusId — the guid identifier of the agent status. This can be retrieved via the listAgentStatuses operation.

More info here:

https://docs.aws.amazon.com/connect/latest/APIReference/API_PutUserStatus.html

ledge
  • 359
  • 1
  • 6