Skip to content

Instantly share code, notes, and snippets.

@okrg
Forked from dommmel/invite_to_slack.js
Last active May 25, 2018 00:06
Show Gist options
  • Save okrg/ff83c3ee5409fd36ab169be3193dcd32 to your computer and use it in GitHub Desktop.
Save okrg/ff83c3ee5409fd36ab169be3193dcd32 to your computer and use it in GitHub Desktop.
Zapier Code to auto invite users to slack
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=" + inputData.email
})
.then(function(res) {
return res.text();
})
.then(function(body) {
var output = {rawHTML: body};
callback(null, output);
})
.catch(callback);
@okrg
Copy link
Author

okrg commented May 25, 2018

According the Zapier help text the object name is inputData
screen shot 38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment