tree: 78bd19d3175988557faaa02c5164fc2428f66876 [path history] [tgz]
  1. actions/
  2. deployment.yaml
  3. manifest.yaml
  4. README.md
tests/usecases/slack/README.md

Using Slack Package with wskdeploy

The Slack usecase demonstrates how to build an OpenWhisk app to post a sample message to slack every hour using wskdeploy.

OpenWhisk comes with a Slack package which can be used to post messages to slack. For our app to post hourly messages, we need:

All you have to do is export few environment variables with your slack webhook settings in deployment.yaml to deploy this app. You can create a new incoming webhook by following step by step instructions from here.

    dependencies:
        slack-package-to-post-messages:
            location: /whisk.system/slack
            inputs:
                username: $SLACK_USERNAME
                url: $SLACK_URL
                channel: $SLACK_CHANNEL

Step 1: Deploy

Deploy it using wskdeploy:

wskdeploy -m tests/usecases/slack/manifest.yaml -d tests/usecases/slack/deployment.yaml

Step 2: Verify

$ wsk package get SlackPackage
$ wsk package get slack-package-to-post-messages
$ wsk trigger get everyhour
$ wsk rule get post-to-slack-every-hour

Step 3: Run

Fire the everyhour trigger and notice a new message on your slack channel:

Activation: post-to-slack (9909dd5229e84526bff9902a2cd860df)
[
    "2017-09-12T23:05:17.17872899Z  stdout: Hello from WskDeploy!",
    "2017-09-12T23:05:17.549177677Z stdout: Posted message to slack"
]