Slack.Web.Admin.Roles (SlackKit v1.0.0-alpha.0)

View Source

Summary

Functions

Adds members to the specified role with the specified scopes

Lists assignments for all roles across entities. Options to scope results by any combination of roles or entities

Removes a set of users from a role for the given scopes and entities

Functions

add_assignments(entity_ids, role_id, user_ids, optional_params \\ %{})

Adds members to the specified role with the specified scopes

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • entity_ids - List of the entity IDs for which roles will be assigned. These can be Org IDs, Team IDs or Channel IDs ex: ['T00000001', 'E00000002']
  • role_id - ID of the role to which users will be assigned ex: R0001
  • user_ids - List of IDs from the users to be added to the given role ex: ['U00000001', 'U00000002', 'U00000003']

Errors the API can return:

  • cannot_modify_role_admin - The user does not have permission to modify the admin role.
  • failed_for_some_entities - At least one role scope ID was invalid
  • failed_for_some_users - At least one user ID was invalid
  • failed_for_some_users_and_entities - At least one role scope ID was invalid
  • feature_not_enabled - This API is currently not enabled.
  • invalid_actor - This API is only enabled for the Admins/Owners.
  • invalid_role_id - The role type passed does not exist.
  • no_valid_entities - None of the entities passed were valid.
  • no_valid_users - None of the users passed were valid.
  • too_many_entities - More than 10 role scopes were passed.
  • too_many_users - More than 10 users were passed.

See the Common Errors guide for errors returned by every Web API method.

list_assignments(optional_params \\ %{})

Lists assignments for all roles across entities. Options to scope results by any combination of roles or entities

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • cursor - Set cursor to next_cursor returned by the previous call to list items in the next page. Search for specific roles by providing the optional role_ids argument, and feel free to bring your own pagination with limit and cursor. ex: 5c3e53d5
  • entity_ids - The entities for which the roles apply ex: ['T12345', 'C12345']
  • limit - The maximum number of items to return. Must be between 1 - 200 both inclusive. Search for specific roles by providing the optional role_ids argument, and feel free to bring your own pagination with limit and cursor. ex: 50
  • role_ids - collection of role ids to scope results by. Search for specific roles by providing the optional role_ids argument, and feel free to bring your own pagination with limit and cursor. ex: ['Rl01', 'Rl0A']
  • sort_dir - Sort direction. Default is descending on date_create, can be either ASC or DESC ex: DESC

Errors the API can return:

  • feature_not_enabled - This API is currently not enabled.
  • invalid_actor - This API is only enabled for the Admins/Owners.
  • invalid_cursor - The passed cursor was invalid.
  • invalid_role_id - One or more role IDs could not be validated.
  • invalid_sort - Sort parameters are invalid.

See the Common Errors guide for errors returned by every Web API method.

remove_assignments(entity_ids, role_id, user_ids, optional_params \\ %{})

Removes a set of users from a role for the given scopes and entities

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • entity_ids - List of the entity IDs for which roles will be revoked. These can be Org IDs, Team IDs or Channel IDs ex: ['T00000001', 'E00000002']
  • role_id - ID of the role to which users will be assigned ex: R0001
  • user_ids - List of IDs of the users whose roles will be revoked ex: ['U00000001', 'U00000002', 'U00000003']

Errors the API can return:

  • cannot_modify_role_admin - Cannot modify role admin.
  • failed_for_some_entities - At least one role scope ID was invalid
  • failed_for_some_users - At least one user ID was invalid
  • failed_for_some_users_and_entities - At least one role scope ID was invalid
  • feature_not_enabled - This API is currently not enabled.
  • invalid_actor - This API is only enabled for the Admins/Owners.
  • invalid_role_id - The role type passed does not exist.
  • no_valid_entities - None of the entities passed were valid.
  • no_valid_users - None of the users passed were valid.
  • too_many_entities - More than 10 role scopes were passed.
  • too_many_users - More than 10 users were passed.

See the Common Errors guide for errors returned by every Web API method.