0

I'm trying to invite users to a Slack team using the users.admin.invite method. This is an undocumented method, therefore there is little information going around. I'm making a POST to https://team_name.slack.com/api/users.admin.invite?t=n&token=token with the following body:

{
email: email
channels: channel
first_name: name
token: token
set_active: true
}

The error I'm getting is invalid_email, but I'm 100% certain that the email is valid. Anyone else has tried this method? Is the body of the post correct? I used Fiddlr and DHC to test the api method.

Thank you.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
vardiles
  • 71
  • 1
  • 5
  • maybe your team is set to a restricted domain (e.g. gmail.com) so you can't invite users from different email domains? – yorammi Feb 20 '16 at 07:33
  • I checked the team settings, and the team is not restricted to a specific domain. When I invite the users using Slack web, I have no problem with the emails. – vardiles Feb 22 '16 at 12:47
  • If this question still is relevant: I can confirm this method still works, and your syntax looks ok. The issue might be the email address itself. I found that Slack is rejecting some temporary email addresses. I you might want to try with another email address first. (double check the address by inviting from the web client). Another thing you can try is call the method with the email parameter only (its the only mandatory parameter) – Erik Kalkoken Mar 25 '16 at 15:27
  • 1
    I tried everything ou suggested, but I couldn't make it work. I invited someone using the web client, and I checked the data it was sending in the request. I noticed it was sending a multipart/form-data. So I tried this, with the corresponing payload and it worked! So, I guess they changed it? – vardiles Mar 28 '16 at 15:34
  • Look at this one, i tried and it works :) http://stackoverflow.com/questions/30955818/slack-api-team-invitation – Wetteren Rémi Aug 23 '16 at 12:53
  • @vardiles thank you very much, after trying with form-data it works. – the_ccalderon Sep 10 '18 at 02:15

0 Answers0