Question

Presence Does Not Change When Using API Call

  • 19 November 2020
  • 2 replies
  • 633 views

Trying to change the users presence from DND to accept all calls using the below script, it successfully takes them out of DND but on the RingCentral app it shows "Do Not Disturb is ON" and other users still see the users presence as "Do Not Disturb"? Is there a param in "Body" that I'm missing in my script, or is this the intended results using this API call?


def turn_off_dnd(*args):
    accountId = "~"
    queryParams = {
        'extensionNumber': _extension.get()
    }
    r = platform.get(f'/restapi/v1.0/account/{accountId}/extension', queryParams)
    _extJson = json.loads(r.text())
    _extId = _extJson['records'][0]['id']

    extensionId = _extId
    body = {
        'userStatus': 'Available',
        'dndStatus': 'TakeAllCalls',
        'allowSeeMyPresence': True,
        'presenceStatus': 'Available',
    }
    r = platform.put(f'/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence', body)

    queryParams = {
    }

    r = platform.get(f'/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence', queryParams)
    _newStatJson = json.loads(r.text())
    _newStat = _newStatJson['dndStatus']

    messagebox.showinfo("New DND Status", "New DND status for " + _extension.get() + ": " + _newStat)



2 replies

In your Api call, in the body make sure while updating the presence status you have

"allowSeeMyPresence":true

If 'True' enables other extensions to see the extension presence status and change will be reflected after update

ref: https://developers.ringcentral.com/api-reference/Presence/readUserPresenceStatus

Hey Anirban, I do have that in the body, it still does not show the user as available and the users app still shows them in DND - but they can receive calls so I know it does actually take them out of DND, just doesn't update the presence for the user or for other users to see

Reply