Skip to main content

We currently use Tray.io (our Ops team made the decision to move off Zapier unfortunately). I see in the API documentation that you can add a role to a user, does it also work with custom roles?

We have an integration with Salesforce that automatically approves their registration if the email is found, then we would like them to be assigned a custom ‘Customer’ role so that they can see customer only info.

@ryanne.perry yes, this will work. I have not used this one recently, but I did experiment with it when I was starting out. I ended up using this API….

https://api2-eu-west-1.insided.com/docs/user/#tag/User/operation/bulkUserAddRole

...to do it in bulk using some JSON from our internal staff application. It worked with no problems whatsoever.


I should add, the bulk api uses Ids. For the “Add a role to a user” API you will need to make sure that you use the role names. 


Thank you for the quick reply @rhall. So would you recommend the bulkUserAddRole vs https://api2-eu-west-1.insided.com/user/{$.steps.trigger.body..'IdentityAccess.UserRegistered'].userId}/role


@ryanne.perry if you have multiple users you want to set roles for at once, then this works very well. I used this to load a couple of hundred staff users at the beginning of our Community.

However, we are using Zapier to do something very similar to you. We are checking emails and email domains against Salesforce to identify customers and partners when they register. We collect their Salesforce Contact (if they have one) and/or their Account (using their email domain if there is not a Contact for the user). We then assign them a Customer or a Partner role based on this and do some other bits and pieces to make sure we can easily link our users when we can import the Gainsight data into Snowflake. This is done one at a time when they register. So I suspect you may not need to use the bulk API for your use case.


Really appreciate you @rhall !

I wanted to add one additional note in case anyone else is using a platform like Tray.io when it comes to custom role assignments.

If you ever need to repeat this process for another role, I’d recommend doing the following:

  1. Identify a User who already has the Role
  2. Get User by field / value, using email as the field and value of the email
  3. The role will be returned, giving you the value you need to use in future Update requests

Reply