Created
May 25, 2016 14:40
-
-
Save dommmel/6726a2cfef07bb58cc03ba7355c148ba to your computer and use it in GitHub Desktop.
Zapier Code to auto invite users to slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slackTeam = "YOUR_SLACK_TEAM_NAME "; | |
var token = 'YOUR_ADMIN_TEST_TOKEN'; | |
// A test token will suffice. | |
// You can generate one at https://api.slack.com/docs/oauth-test-tokens | |
// Just make sure that the user issuing the test token is an admin. | |
var url = 'https://'+ slackTeam + '.slack.com/api/users.admin.invite'; | |
fetch(url, { | |
method: 'POST', | |
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, | |
body: "token="+ token + "&email=" + input.email | |
}) | |
.then(function(res) { | |
return res.text(); | |
}) | |
.then(function(body) { | |
var output = {rawHTML: body}; | |
callback(null, output); | |
}) | |
.catch(callback); | |
Hey @dommmel any chance you have an updated script since Slack deprecated workspace tokens and now requires OAuth authentication flow?
Did anyone find out how to do this since the legacy tokens are now disabled?
Any update guys?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many thanks for the solution!