Skip to content

runnerty/notifier-slack

Repository files navigation

Smart Processes Management

NPM version Downloads Dependency Status code style: prettier

Slack notifier for Runnerty:

Installation:

Through NPM

npm i @runnerty/notifier-slack

You can also add modules to your project with runnerty

npx runnerty add @runnerty/notifier-slack

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty globally you can include the module with this command:

runnerty add @runnerty/notifier-slack

Configuration sample:

Add in config.json:

{
  "notifiers": [
    {
      "id": "slack_default",
      "type": "@runnerty-notifier-slack",
      "token": "MY_BOT_TOKEN",
      "bot_name": "Runnerty-Sentinel",
      "channel": "MY_CHANNEL",
      "maxConcurrents": 1,
      "minInterval": 600
    }
  ]
}

Plan sample:

Add in plan.json:

  • Simple
{
  "id": "slack_default",
  "bot_emoji": ":metal:",
  "channel": "MY_CHANNEL",
  "message": "PROCESS *:PROCESS_ID* OF CHAIN :CHAIN_ID RUNNING!"
}
  • Attachments
{
  "id": "slack_default",
  "bot_name": "Runnerty Bot",
  "bot_emoji": ":metal:",
  "channel": "MY_CHANNEL",
  "attachments": [
    {
      "fallback": "Required plain-text summary of the attachment.",
      "color": "#36a64f",
      "pretext": "Simple sample pretext",
      "author_name": "Runnerty Bot",
      "author_link": "https://github.com/runnerty/notifier-slackhttp://runnerty.io",
      "author_icon": "https://runnerty.io/assets/header/logo-stroked.png",
      "title": "Slack attachment sample",
      "title_link": "https://api.slack.com/docs/messages/builder",
      "text": "More info",
      "fields": [
        {
          "title": "Priority",
          "value": "High",
          "short": false
        }
      ],
      "image_url": "http://my-website.com/path/to/image.jpg",
      "thumb_url": "https://runnerty.io/assets/header/logo-stroked.png",
      "footer": "Runnerty Notifier Slack Sample",
      "footer_icon": "https://runnerty.io/assets/header/logo-stroked.png"
    }
  ]
}
  • Upload File
{
  "id": "slack_default",
  "bot_emoji": ":metal:",
  "channel": "MY_CHANNEL",
  "message": "PROCESS *:PROCESS_ID* OF CHAIN :CHAIN_ID RUNNING!",
  "file": "./resume.csv"
}