Unable to update User Presence

I am trying to change the user presence for a user using java sdk. OrganizationPresence id setter is not not available. Is some things i missing here?
Could you please suggest how to set the Presence. Below are my code snippet

PresenceApi apiInstance = new PresenceApi();
String userId = "testuserid"; // String | user Id
String sourceId = "227b37e2-f1d0-4dd0-8f50-badd7cf6d158"; // BREAK
UserPresence body = new UserPresence(); // UserPresence |
OrganizationPresence orgPre = new OrganizationPresence();

try {

//orgPre.setId(sourceId); missing setter
body.setPresenceDefinition(orgPre);
UserPresence result = apiInstance.patchUserIdPresencesSourceId(userId, sourceId, body);
System.out.println(result);

} catch (ApiException e) {
System.err.println("Exception when calling PresenceApi#patchUserIdPresencesSourceId");
e.printStackTrace();
}

The short answer is to use an object from the presence API's getPresencedefinitions() or getSystempresences() methods. I'll work on creating an example for this.

I tried getSystempresences() object. looks like it's working for few status only.

Example for not working for Meal, Meeting

try {

body.setMessage("BREAK");
body.setName("BREAK");
body.setPrimary(true); 

UserPresence result = apiInstance.patchUserIdPresencesSourceId(userId, presenceId, body);

} catch (ApiException e) {
System.err.println("Exception when calling PresenceApi#patchUserIdPresencesSourceId");
e.printStackTrace();
}

Hi Tim,

After executing above method the presence status is changed as expected. after that i was trying to change the presence in ININ console the presence status didn't change.

Did you get chance to create working sample for this

-Murugan

I've posted the tutorial here: https://github.com/MyPureCloud/developercenter-tutorials/blob/master/presence/java/src/com/genesys/Main.java

I am also working on adding a notification handler class to the SDK like I did for .NET. I will update the tutorial with that once it's added and will publish the tutorial on the dev center once that's added.

Verified it's works as expected. Thanks Tim !

I need to indicate ACW status in our application. could you please let me know but Which topic i need to subscribe ?

-Murugan

ACW isn't an actual property of a user or conversation, so there's not a specific event that comes right out and says "I'm doing ACW now". To determine if a user is in ACW, keep an eye on their conversations. The agent can be considered in ACW for a conversation when their participant object meets the following criteria:

  • userId=agent's ID
  • wrapupRequired=true
  • wrapup=null (property does not exist)
  • endTime has a value

The agent will no longer be in ACW once they specify a wrap up code, which is identified by the wrapup property being set to a value on their participant object.

It should be noted that because an agent can take multiple interactions simultaneously, the agent can be simultaneously handling one interaction while being in ACW on another.

Thanks Tim !. Let me filter routing status from conversation notification

@tim.smith tutorial link is not working anymore.. Are you able to share it again please?

Link has been updated.