Last active
June 16, 2017 19:37
-
-
Save jessehanley/209ceee4c4848438273d5b88cb991407 to your computer and use it in GitHub Desktop.
Slack Invite: Simple Javascript Form
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
<!-- Get your token here https://api.slack.com/custom-integrations/legacy-tokens --> | |
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
<input id="email" type="text" placeholder="Email for invite"> | |
<button onclick="sendInvite()">Apply</button> | |
<script> | |
function sendInvite() { | |
var email = $('#email').val(); | |
axios.get('https://slack.com/api/users.admin.invite?token={ID GOES HERE}&email='+email) | |
.then(function (response) { | |
console.log(response); | |
location.reload(); | |
}) | |
.catch(function (error) { | |
console.log(error); | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment