Skip to content

Instantly share code, notes, and snippets.

@jessehanley
Last active June 16, 2017 19:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessehanley/209ceee4c4848438273d5b88cb991407 to your computer and use it in GitHub Desktop.
Save jessehanley/209ceee4c4848438273d5b88cb991407 to your computer and use it in GitHub Desktop.
Slack Invite: Simple Javascript Form
<!-- 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