Skip to content

Instantly share code, notes, and snippets.

@mdlawson
Last active September 15, 2015 14:21
Show Gist options
  • Select an option

  • Save mdlawson/1f21610ff42d063daebe to your computer and use it in GitHub Desktop.

Select an option

Save mdlawson/1f21610ff42d063daebe to your computer and use it in GitHub Desktop.
Google script for slack invites, deploy on https://script.google.com
function doGet(e) {
var response = UrlFetchApp.fetch("https://" + SLACK_TEAM_NAME + ".slack.com/api/users.admin.invite", {
"method" : "post",
"payload": {
"token": SLACK_API_TOKEN,
"set_active": "true",
"email": Session.getActiveUser().getEmail(),
}
});
var result = JSON.parse(response.getContentText());
if (result.ok) {
return ContentService.createTextOutput("Invited to slack, check your email!");
} else {
return ContentService.createTextOutput("Something went wrong");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment