Whisk Deploy — Slack Package

Priti Desai
Nov 20, 2017 · 2 min read

OpenWhisk offers a Slack Package which can be used to post messages to Slack. Lets look at how we can create package binidng using wskdeploy:

Step 1: Create a manifest file (manifest.yaml)

To create slack package binding, we have to specify it as one of the dependencies using location as /whisk.system/slack in manifest.yaml file:

First, we need to setup an incoming webhook integration in our slack workspace. Configure new webhook for the slack channel we need to send messages to by following step by step instructions from here.

Now, we can integrate this slack package into our application to send a message to slack channel every hour using the following manifest.yaml:

You can get an action file post-to-slack.js from here.

Step 2: Create a deployment file (deployment.yaml)

Step 3: Deploy a sample application

./wskdeploy -p ~/AppToPostToSlack/
____ ___ _ _ _ _ _
/\ \ / _ \ _ __ ___ _ __ | | | | |__ (_)___| | __
/\ /__\ \ | | | | '_ \ / _ \ '_ \| | | | '_ \| / __| |/ /
/ \____ \ / | |_| | |_) | __/ | | | |/\| | | | | \__ \ <
\ \ / \/ \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\
\ __\/ |_|

At this point, we have an action post-to-slack configured to run every hour. We can verify our deployment by firing a trigger and checking if action is invoked by following instructions from Whisk Deploy — Action, Trigger, and Rule. Once we have the everyhour trigger fired, we should recieve a new message on our 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"
]

Enjoy!

Apache OpenWhisk

Apache OpenWhisk is a serverless cloud platform that…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store