Need help with api call to set user presence


I am new to rocketchat and API calls but I was able to figure out how to make REST calls. Now I am looking to create a REALTIME call that will set a user status from Online to Away. The call is documented as this:

“msg”: “method”,
“method”: “UserPresence:away”,
“id”: “42”,

I can successfully connect to my webhook URL but I’m not sure how to use the above example to set a users presence. How do I specify a user? What is the “id” value? I see id:42 in other api examples and i’m not sure if thats just an example or if its required.


I’ve tried the following, setting ‘id’ with a users “_id” and also the “id” given from LDAP. Is this supposed to be some other value? With either ID it returns {“success”:true} and posts to bot with “User Presence Set” but the users status is unchanged. What am I missing? Thanks!

import requests
import json

uri = ''
data = {
    "msg": "User Presence Set",
    "method": "UserPresence:away",
    "id": "a1b2c3d4",
    "params": []

r =, json.dumps(data)).content