Slack.Web.Users (SlackKit v1.0.0-alpha.0)

View Source

Summary

Functions

List conversations the calling user is a member of.

Delete the user profile photo

Gets user presence information.

Get a user's identity.

Gets information about a user.

Lists all users in a Slack team.

Find a user with an email address.

Marked a user as active. Deprecated and non-functional.

Set the user profile photo

Manually sets user presence.

Functions

conversations(optional_params \\ %{})

List conversations the calling user is a member of.

API reference

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

View on docs.slack.dev ↗

Optional Params

  • cursor - Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. ex: dXNlcjpVMDYxTkZUVDI=
  • exclude_archived - Set to true to exclude archived channels from the list ex: true
  • limit - The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer with a max value of 999. ex: 20
  • team_id - encoded team id to list conversations in, required if org token is used
  • types - Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im ex: im,mpim
  • user - Browse conversations by a specific user ID's membership. Non-public channels are restricted to those where the calling user shares membership. ex: W0B2345D

Errors the API can return:

  • invalid_cursor - Value passed for cursor was not valid or is no longer valid.
  • invalid_limit - Value passed for limit is not understood.
  • invalid_types - Value passed for type could not be used based on the method's capabilities or the permission scopes granted to the used token.
  • method_not_supported_for_channel_type - This type of conversation cannot be used with this method.
  • missing_argument - A required argument is missing.

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

delete_photo(optional_params \\ %{})

Delete the user profile photo

API reference

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

View on docs.slack.dev ↗

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

get_presence(optional_params \\ %{})

Gets user presence information.

API reference

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

View on docs.slack.dev ↗

Optional Params

  • user - User to get presence info on. Defaults to the authed user.

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

identity(optional_params \\ %{})

Get a user's identity.

API reference

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

View on docs.slack.dev ↗

Errors the API can return:

  • email_not_verified - user email has not been verified
  • invalid_user_id - Invalid user id provided

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

info(user, optional_params \\ %{})

Gets information about a user.

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • user - User to get info on

Optional Params

  • include_locale - Set this to true to receive the locale for this user. Defaults to false

Errors the API can return:

  • too_many_users - Too many users.
  • user_not_found - Value passed for user was invalid.
  • user_not_visible - The requested user is not visible to the calling user

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

list(optional_params \\ %{})

Lists all users in a Slack team.

API reference

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

View on docs.slack.dev ↗

Optional Params

  • cursor - Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. ex: dXNlcjpVMDYxTkZUVDI=
  • include_locale - Set this to true to receive the locale for users. Defaults to false
  • limit - The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors. 0 ex: 20
  • team_id - encoded team id to list users in, required if org token is used

Errors the API can return:

  • invalid_cursor - Value passed for cursor was not valid or is no longer valid.
  • limit_required - For large teams a limit is required.
  • missing_argument - A required argument is missing.

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

lookup_by_email(email, optional_params \\ %{})

Find a user with an email address.

API reference

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

View on docs.slack.dev ↗

Required Params

  • email - An email address belonging to a user in the workspace ex: spengler@ghostbusters.example.com

Errors the API can return:

  • users_not_found - Value passed for user was invalid.

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

set_active(optional_params \\ %{})

Marked a user as active. Deprecated and non-functional.

API reference

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

View on docs.slack.dev ↗

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

set_photo(optional_params \\ %{})

Set the user profile photo

API reference

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

View on docs.slack.dev ↗

Optional Params

  • crop_w - Width/height of crop box (always square). Providing a "crop box" with crop_x, crop_y, and crop_w is optional. ex: 100
  • crop_x - X coordinate of top-left corner of crop box. Providing a "crop box" with crop_x, crop_y, and crop_w is optional. ex: 10
  • crop_y - Y coordinate of top-left corner of crop box. Providing a "crop box" with crop_x, crop_y, and crop_w is optional. ex: 15
  • image - File contents via multipart/form-data. ex: ...

Errors the API can return:

  • bad_image - The uploaded image could not be processed - try passing a JPEG, GIF or PNG
  • too_large - The uploaded image had excessive dimensions
  • too_many_frames - An animated GIF with too many frames was uploaded

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

set_presence(presence, optional_params \\ %{})

Manually sets user presence.

API reference

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

View on docs.slack.dev ↗

Required Params

  • presence - Either auto or away Acceptable values: auto away ex: away

Errors the API can return:

  • invalid_presence - Value passed for presence was invalid.

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