Search code examples
asp.net-web-apislackslack-api

Slack Web API not updating user profile


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 "[email protected]" 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)


Solution

  • 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": "[email protected]",
                    "primary": true
                }
            ]
        }
    

    With that I was able to update the email.