/nexrender-action-slack-message

Utility module for sending a Slack alert when render start/finish or render error.

Primary LanguageJavaScript

nexrender-action-slack-message

Utility module for sending a Slack message when render start/finish or render error.

Installation

Install the module via Git :

npm i -g https://github.com/oksr/nexrender-action-slack-message

Usage

At first, If you don't already have a Slack app, you'll need to create one.

It is best to follow the practice at Slack offical documentation: https://api.slack.com/apis/connect

Once you created the app, give it the correct scope and add it to your workspace and channel - you can use this module.

You'll need to declare new env variable named SLACK_TOKEN with the value you got from slack - starting with "xoxb-..."

Finally, you add the module for pre/postrender messages as you wish:

"actions":{
    "prerender":[{
        "module": "nexrender-action-slack-message",
        "conversationId": "YOUR_CHANNEL_ID_HERE",
        "text": "OPTIONAL_TEXT"
    }],
    "postrender":[{
        "module": "nexrender-action-slack-message",
        "conversationId": "YOUR_CHANNEL_ID_HERE",
        "text": "OPTIONAL_TEXT"
    }]
}

The content of the message (json) is controlled by getAttachment(job, type) which is conditionally changed based on the action's type.

Screenshot

Slack offers wonderfull Block Kit Builder link which helps you design and test the attachments you want to send as message.

Happy coding! 🍻