Permalink
Switch branches/tags
Nothing to show
Find file Copy path
46 lines (40 sloc) 3.15 KB

users.admin.invite

This method sends invitation to a new user by email This endpoint uses a legacy token to authenticate. Please make sure you are using this token type and not one of the newer types.

Arguments

This method has the URL https://slack.com/api/users.admin.invite and follows the Slack Web API calling conventions.

Argument Example Required Description
token xxxx-xxxxxxxxx-xxxx Required Authentication token (Requires scope: 'client')
email john.doe@email.com Required Email address of the new user
channels C1234567890,G12345678 Optional Comma-separated list of IDs (not names!) for channels, which the new user will auto-join. Both channel IDs for public channels and group IDs for private chanels work.
first_name John Optional Prefilled input for the "First name" field on the "new user registration" page.
last_name Doe Optional Prefilled input for the "Last name" field on the "new user registration" page.
resend true Optional Resend the invitation email if the user has already been invited and the email was sent some time ago.
restricted true Optional Invite a guest that can use multiple channels
ultra_restricted true Optional Invite a guest that can use one channel only
expiration_ts 1510863690 Optional Set the expiration timestamp for which the account will automatically be removed

Hints

  • Please make sure to use a legacy token with this API method. It will not work with any other token type.
  • Sending an invite to an email address will only work once. Additional requests to the same email address will be ignored. However, if the invite is still pending you can remove it (through the admin interface) and sent another one.

Response

You will receive a standard Slack API response in JSON as described here. For example if successful you get:

{
"ok": true
}

Errors & Warnings

Error Description
already_invited User has already received an email invitation
already_in_team User is already part of the team
channel_not_found Provided channel ID does not match a real channel
sent_recently When using resend=true, the email has been sent recently already
user_disabled User account has been deactivated
missing_scope Using an access_token not authorized for 'client' scope
invalid_email Invalid email address (e.g. "qwe"). Note that Slack does not recognize some email addresses even though they are technically valid. This is a known issue.
not_allowed When SSO is enabeld this method can not be used to invite new users except guests. The SCIM API needs to be used instead to invite new users. For inviting guests the restricted or ultra_restricted property needs to be provided
not_allowed_token_type Token type is invalid. Workspace tokens do not seem to be compatible with this method
requires_one_channel When ultra_restricted is true and no channel is provided. A single channel must be provided.
not_authed No authentication token provided.