You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
modules/slackme
Michael Smith 438c904567
chore: cleanup all test files (#293)
## Changes made
- Removed all unused imports, and made sure type imports were labeled
correctly
- Updated all comparisons to be more strict
- Simplified loops to remove unneeded closure functions
- Removed all explicit `any` types
- Updated how strings were defined to follow general TypeScript best
practices

## Notes
- We definitely want some kind of linting setup for this repo. I'm going
to bring this up when Blueberry has its next team meeting next week
10 months ago
..
README.md chore: bump version to 1.0.2 and add script to update them automatically. (#128) 1 year ago
main.test.ts chore: cleanup all test files (#293) 10 months ago
main.tf feat: add slackme module (#85) 2 years ago
slackme.sh Add formatting check for shell scripts (#106) 2 years ago

README.md

display_name description icon maintainer_github verified tags
Slack Me Send a Slack message when a command finishes inside a workspace! ../.icons/slack.svg coder true
helper

Slack Me

Add the slackme command to your workspace that DMs you on Slack when your command finishes running.

slackme npm run long-build

Setup

  1. Navigate to Create a Slack App and select "From an app manifest". Select a workspace and paste in the following manifest, adjusting the redirect URL to your Coder deployment:

    {
      "display_information": {
        "name": "Command Notify",
        "description": "Notify developers when commands finish running inside Coder!",
        "background_color": "#1b1b1c"
      },
      "features": {
        "bot_user": {
          "display_name": "Command Notify"
        }
      },
      "oauth_config": {
        "redirect_urls": [
          "https://<your coder deployment>/external-auth/slack/callback"
        ],
        "scopes": {
          "bot": ["chat:write"]
        }
      }
    }
    
  2. In the "Basic Information" tab on the left after creating your app, scroll down to the "App Credentials" section. Set the following environment variables in your Coder deployment:

    CODER_EXTERNAL_AUTH_1_TYPE=slack
    CODER_EXTERNAL_AUTH_1_SCOPES="chat:write"
    CODER_EXTERNAL_AUTH_1_DISPLAY_NAME="Slack Me"
    CODER_EXTERNAL_AUTH_1_CLIENT_ID="<your client id>
    CODER_EXTERNAL_AUTH_1_CLIENT_SECRET="<your client secret>"
    
  3. Restart your Coder deployment. Any Template can now import the Slack Me module, and slackme will be available on the $PATH:

    module "slackme" {
      source           = "registry.coder.com/modules/slackme/coder"
      version          = "1.0.2"
      agent_id         = coder_agent.example.id
      auth_provider_id = "slack"
    }
    

Examples

Custom Slack Message

  • $COMMAND is replaced with the command the user executed.
  • $DURATION is replaced with a human-readable duration the command took to execute.
module "slackme" {
  source           = "registry.coder.com/modules/slackme/coder"
  version          = "1.0.2"
  agent_id         = coder_agent.example.id
  auth_provider_id = "slack"
  slack_message    = <<EOF
👋 Hey there from Coder! $COMMAND took $DURATION to execute!
EOF
}