0.1.1 • Published 8 years ago

serverless-slack-plugin v0.1.1

Weekly downloads
107
License
MIT
Repository
github
Last release
8 years ago

Serverless Slack Plugin

A Slack Bot plugin for the Serverless Framework which will post updates to a channel on completion of deployments or removals of functions and/or endpoints.

serverless npm version Dependencies Status DevDependencies Status

Installation

Make sure you have the Serverless Framework installed and you're using Node.js v4.0+.

Install the plugin in the root of your Serverless Project:

npm install serverless-slack-plugin --save-dev

Add the plugin to the plugins array in your Serverless Project's s-project.json, like this:

plugins: [
    "serverless-slack-plugin"
]

Configuration

First you will need to configure a "bot user" in your Slack team for the integration, instructions on how to do that can be found in the Slack documentation.

Hint: Don't forget to invite your bot user into the channel you want it to post into!

Once you have generated a token for your bot user and the name of the channel, in the custom property of either your s-project.json or s-function.json add the following:

{
    ...
    "custom": {
      "slack": {
        "token": "<YOUR SLACK CHAT BOT TOKEN>",
        "channel": "<THE CHANNEL YOU WANT TO POST TO>",
        "endpoints": true, // All endpoint deployments and removals will result in a message
        "functions": {
          "deployed": true, // Function deployments will result in a message
          "removed": true // Function removals will result in a message
        }
      }
    }
    ...
}

Note: For both endpoints and functions you can either enable/disable deployments and removals discretely or globally as above

Usage

Once configured any of the following actions will result in a summary message being sent to the configured channel.

serverless dash deploy

Deploy functions

serverless function deploy

Deploy functions

serverless function remove

Remove functions

serverless endpoint deploy

Deploy endpoints

serverless endpoint remove

Remove endpoints

License

MIT License. See the LICENSE file.