1

I would like to use the Slack Web API to update information of a user in the org. I appear to be getting a successful(200s) responses from the API however the user's information is never actually updated. The API shows no signs in the response that the payload was malformed and that is the cause for the failure to update. Just gives a 200 and then returns the "profile" of the user but without the newest update. Here is the current curl I am making (with tokens and PII scrubbed of course)

Link to Slack Docs for User.profile.set:

https://api.slack.com/methods/users.profile.set

curl -v -X POST -H "Authorization: Bearer xoxp-123123-1231-1231"
-F "user=USERID" -F "name=email" -F "value=jon.temp@gmail.com" https://slack.com/api/users.profile.set

I have also attempted the same request with the a json payload instead of a form like shown above and have had the same result.

The response of this request is the profile of the user without any of the attributes updated (In this case I want to update email)

Corey Smith
  • 71
  • 10
  • Does the calling user have permission to change the email? That should definitely fire an error, but the cURL below is working as expected for me, so trying to eliminate other issues. `curl -X POST \ https://slack.com/api/users.profile.set \ -H 'Authorization: Bearer xoxp-123456789-123456789-123456789-123456789123456789' \ -H 'Content-Type: application/json; charset=utf-8' \ -d '{ "name": "email", "value": "test@slack.com", "user": "U12345678" }'` – Colm Doyle Jan 02 '19 at 11:19
  • @ColmDoyle The calling user had admin scope but after opening a ticket with slack it was an issue I should have been more aware of. The org currently has adjusting email disabled for the users (because users are provisioned through SAML integration) so it was also disabled via the API. However, I was using the web API and I was able to use the SCIM API to accomplish what I wanted to above. – Corey Smith Jan 03 '19 at 00:22

1 Answers1

1

The problem above stemmed from the organization having "adjusting email" disabled and even though this call was made from an admin account that API endpoint does not support changing the email if its disabled for the Organization. Simply used the SCIM API

https://api.slack.com/scim/v1/Users/

with a similar payload presented in my question.

 {
        "schemas": [
            "urn:scim:schemas:core:1.0"
        ],
        "emails": [
            {
                "value": "john.temp@www.com",
                "primary": true
            }
        ]
    }

With that I was able to update the email.

Corey Smith
  • 71
  • 10