How can we help?

Custom Action: Slack - Remove user from channel

Andrew Bartel
Andrew Bartel
  • Updated

A Slack user can be removed from a channel using a custom action from a Torii workflow.

Requirements

  1. Create an app using Slack's Quickstart guide: https://api.slack.com/start/quickstart
  2. Navigate to https://api.slack.com/apps > Your App Name > OAuth & Permissions. Add the field Bot User OAuth Token as a secret in Torii.
    • Install your app to the workspace.
    • Under Scopes add channels:managed, groups:write, im:write, mpim:write
  3. Add the app to the channel in Slack where you want to delete users.

Custom Action Configuration

Method: POST

URL: https://slack.com/api/conversations.kick

Query Parameters

Parameter Variable Mapping
channel channel id
user user id

Headers

Header Value
Accept */*
Authorization Bearer [SecretsVault.SlackAPIToken]

Store your Slack API token in Torii using our Secrets Vault.

Body

Not required.

Notes

If you get a restricted_action error when using the action, the workspace permissions need to be changed in order to allow this API call. They can be found under Permissions > Channel Management Change the People who can remove members from public channels setting to Everyone, except guests.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request