I read the post here to invite all team members to a channel.

On the reverse side, I now need to invite a single team member to all my Slack channels.

Does anyone knows how I can do this?

2 Answers 2


Found ! The code requires 2 parameters. You need a user that is already invited to all the channels in which you want to invite the new team member (in my case, any collaborator of my team is invited to all channels). You need the user ID of the new team member, and you need the connection token of the previous user which is already in all channels. You can get the user ID of the new team member through slack API using Postman for instance.

Once you have those parameters, replace them in then execute the below code :

var express = require(‘express’);
var router = express.Router();
var rp = require(‘request-promise’);

/* GET home page. */


router.get(‘/’, function(req, res, next) {
    let url = “https://slack.com/api/groups.list”
    var options = {
        method: ‘POST’,
        headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’},
        uri: url,
        form: {
            token: TOKEN_USER_already_in_target_channels,
            exclude_archived: true
        json: true // Automatically stringifies the body to JSON
    .then(parsedBody => {
        console.log(“OK: “+parsedBody)
        var promised_array = parsedBody.groups.map(item => {
            var url_invit = “https://slack.com/api/groups.invite”
            var option_invit = {
                method: ‘POST’,
                headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’},
                uri: url_invit,
                form: {
                    token: TOKEN_USER_already_in_target_channels,
                    user: ID_USER_TO_INVITE,
                    channel: item.id
            return rp(option_invit)
        Promise.all(promised_array).then(result => {
    .catch(err => {
        console.log(“ERR: “+err)

 // res.render(‘index’, { title: ‘Express’ });

module.exports = router;

@leonardmaguin - Thank you for this! For someone who doesn't know much about coding besides basic HTML/CSS where would I go to run this code? Node terminal? I'm sorry for such a lame question and over 4 years later. Also, I'm sorry if I didn't post this correctly, it would not allow me to add a comment since I just created my account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.