Last active
September 15, 2015 14:21
-
-
Save mdlawson/1f21610ff42d063daebe to your computer and use it in GitHub Desktop.
Google script for slack invites, deploy on https://script.google.com
This file contains hidden or 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
| 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