Seeing no other way, I was able to "solve" this using the REST API. It is a bad idea?
I simplified my actual code to answer the original question.
user = robot.brain.userForName(res.message.user.name) robot.http("https://xxx.xxx.xxx/api/v1/users.info?userId=" + user['id']) .headers("X-Auth-Token":"xxxxxxxxxxxxxxx", "X-User-Id":"xxxxxxx") .get() (err, response, body) -> Info = JSON.parse(body) Info.user.roles.push("newRole") robot.http("https://xxx.xxx.xxx/api/v1/users.update") .headers("X-Auth-Token":"xxxxxxxxxxxxxxx", "X-User-Id":"xxxxxxx", "Content-type":"application/json") .post('{"userId": "' + user['id'] + '", "data": { "roles": ' + JSON.stringify(Info.user.roles) + ' }}')
source share