var slackTeam = "YOUR_SLACK_TEAM_NAME "; var token = 'YOUR_ADMIN_TEST_TOKEN'; var channels = 'C1234567890,G12345678'; // 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=" + input.email + "&channels=" + channels }) .then(function(res) { return res.text(); }) .then(function(body) { var output = {rawHTML: body}; callback(null, output); }) .catch(callback);