← Integrations

Slack

Read channels and users, and post messages as the signed-in Slack user.

  • Communication
  • OAuth 2.0 + PKCE
  • Works on Free plan
  • Bundled in Kirak
  • Maintained by Kirak
View on GitHub →

How to use it

This profile ships with Kirak. Add "integrations" to modules in kirak.json, then name the profile as below. There is nothing to download, and a copy in your project's integrations/ folder is an error.

Environment variables

VariableHolds
KIRAK_INTEGRATION_SLACK_CLIENT_SECRETThe OAuth client secret from the vendor's console. Secret: keep it out of kirak.json and out of source control.
KIRAK_AUTH_ENCRYPTION_KEYSEncrypts stored tokens. Shared by every integration; the module refuses to start without it.

The names follow the integration's name in kirak.json (slack here). Name it something else, such as slack_sales, and the variables change to match.

Redirect URL

Register this as the redirect (callback) URL in the vendor's console, with your app's address in place of <your-app> (the base_url in kirak.json):

https://<your-app>/integrations/slack/callback

How to get your keys

  1. Open Slack’s app page and choose Create New App > From scratch.
  2. Under OAuth & Permissions, add https://<your-app>/integrations/slack/callback as a redirect URL.
  3. Under User Token Scopes (not bot scopes), add the scopes your app needs. At least: users:read (Read user profiles in the workspace), channels:read (View basic information about channels)
  4. Under Basic Information > App Credentials, copy the client ID and the client secret.
  5. Put the client ID in kirak.json as integrations.providers.slack.client_id, and the client secret in the environment as KIRAK_INTEGRATION_SLACK_CLIENT_SECRET. Never put the secret in kirak.json.

The vendor's own guide · Instructions out of date? ·Suggest an edit

kirak.json

Scopes
{
  "integrations": {
    "providers": {
      "slack": {
        "type": "oauth2",
        "profile": "slack",
        "client_id": "your-client-id",
        "scope": [
          "users:read",
          "channels:read"
        ]
      }
    }
  }
}

Merged into the profile: scope replaces the profile's default scopes.

Good to know

  • User tokens are read from authed_user, because the scopes go in user_scope. Bot scopes would use scope and a bot token.
  • Slack tokens do not expire unless token rotation is turned on for the app; with rotation, the app must refresh them.
  • The workspace is the account: one connection per workspace (team.id).
  • Scope separator and the redirect URL rules (https even for local development) are to be confirmed in Slack's app settings before a release.

Example calls

GET /conversations.list
List the channels the user can see
Ask about Kirak on