Send an invite email to a new hire to join your Slack team (one team, but multiple channels per integration).

You will need to be on the enterprise Slack plan to make this work!

Manifest

{
    "form": [
        {
            "id": "CHANNELS",
            "url": "https://slack.com/api/conversations.list?team_id={{TEAM_ID}}",
            "name": "The channels to add the new hire to",
            "type": "multiple_choice",
            "method": "GET",
            "data_from": "channels",
            "choice_name": "name",
            "choice_value": "id"
        }
    ],
    "exists": {
        "url": "https://slack.com/api/users.lookupByEmail?email={{email}}",
        "method": "POST",
        "expected": "\"{{email}}\""
    },
    "execute": [
        {
            "url": "https://slack.com/api/admin.users.invite",
            "data": {
                "email": "{{ email }}",
                "resend": true,
                "team_id": "{{ TEAM_ID }}",
                "channel_ids": "{{ CHANNELS|join:',' }}"
            },
            "method": "POST"
        }
    ],
    "headers": {
        "Accept": "application/json",
        "Content-Type": "application/json",
        "Authorization": "Bearer {{TOKEN}}"
    },
    "initial_data_form": [
        {
            "id": "TOKEN",
            "name": "Bot User OAuth Token",
            "description": "You can find it here: https://api.slack.com/apps (under `Install App`) after you have installed it in your team"
        },
        {
            "id": "TEAM_ID",
            "name": "Your team id",
            "description": "Here is a how-to on how to find your team id: https://help.socialintents.com/article/148-how-to-find-your-slack-team-id-and-slack-channel-id"
        }
    ]
}

Instructions

  • Create a new integration with this manifest.
  • Create a new Slack app here: https://api.slack.com/apps.
  • Give it any name and then add the scopes admin.users:write, channels:read, users:read.email under the USER scopes.
  • Install the app in your workspace.
  • Copy the User auth token and paste it in the field.

Additional notes

You will need to be on the enterprise Slack plan to make this work!

Comments

No comments yet.