Skip to content

totvs/pulumi-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What this provider can do?

  • Channels: can create public, private, add description, purpose, etc...
  • User: bind existenting user to a channel

A channel cannot be deleted, this provider rename and archive the channel.

Permissions

We need to configure some scopes to manage resources (Bot tokens):

  1. Open https://api.slack.com/apps
  2. Create new App
  3. Configure App Name and Workspace to develop
  4. Use the manifest below
_metadata:
  major_version: 1
  minor_version: 1
display_information:
  name: pulumi-resource-slack
features:
  bot_user:
    display_name: pulumi-resource-slack
    always_online: false
oauth_config:
  scopes:
    bot:
      - channels:manage
      - groups:write
      - im:write
      - mpim:write
      - groups:read
      - channels:read
      - im:read
      - mpim:read
      - users:read
      - users:read.email
settings:
  org_deploy_enabled: false
  socket_mode_enabled: false
  token_rotation_enabled: false
  1. Open menu Oauth & Permissions
  2. Click on Install to Workspace and allow requested permissions
  3. Go to menu Features/Oauth & Permissions
  4. Copy the bot user oauth token to be used by this provider

Other tips

If you are facing problems to manage channel members, even if you add permission scopes to the bot user, check the channel management.

https://YOUR-WORKSPACE-HERE.slack.com/admin/settings#channel_management_restrictions

Environment

You need to set Slack token with:

export SLACK_TOKEN xoxb-2271973586641-3369578963123-hngThgT5dq4W7vmHdzd91T3H

or

pulumi config set --secret slack:config:token xoxb-2271973586641-3369578963123-hngThgT5dq4W7vmHdzd91T3H

Installation

You can download the latest provider from releases and install with:

pulumi plugin install resource slack 0.0.5 -f /tmp/pulumi-resource-slack-v0.0.5-alpha.1636395768+d62d844a-linux-amd64.tar.gz

Pre-requisites to develop

Install the pulumictl cli from the releases page or follow the install instructions

NB: Usage of pulumictl is optional. If not using it, hard code the version in the Makefile of when building explicitly pass version as VERSION=0.0.1 make build

Build and Test

# build and install the resource provider plugin
$ make build install

# test
$ cd examples/ts
$ yarn link @pulumi/slack
$ yarn install
$ pulumi stack init test
$ pulumi up