Data Driven Slack Messaging with Alteryx
by Kevin Anderson, on September 8, 2016
If you keep up with the Arkatechture blog you may have read how our software engineers are using Raspberry PI’s to post messages to our slack channels when a fresh pot of coffee or popcorn is ready for consumption. This got me thinking- wouldn’t it be great if we could post messages with more data driven content? Wouldn’t it be even better if I could add this feature to the Alteryx workflows that keep our internal database up to date?
Well, Alteryx doesn’t just let you pull data off an API, it also lets you post data as well! Read on to find out how to use Alteryx to post real time, data driven messages to your own Slack channel.
For the purposes of this writing I am going to assume you have a Slack account. If not, you can sign up for a free account at www.slack.com. Once you have an account you will need to set up a custom integration in your Slack settings. Fear not, this is not as complex as it sounds. From your slack channel append your website URL with the following: /apps/build/custom-integration. (example - https://yourslackinstancename.slack.com/apps/build/custom-integration.)
You are now ready to set up a custom integration!
From this page do the following:
1.Select Incoming Webhooks
2. Select a Default Slack Channel for this Integration.
You can always change this later. Go ahead and select the #general channel, or whichever channel you like best.
3.You Are Done!
On the final screen grab your webhook URL for use in Alteryx
We can now use the Alteryx download tool to post information to this URL.
The basic workflow is as follows:
The first text input tool stores the parameters for the basic parts of a Slack message, this data is then appended to the URL we created above then parsed to JSON. Finally, the JSON is posted to the Slack URL using the Alteryx download tool.
The results display as follows:
Any data Alteryx has access to can be used to create your message strings!
Over on the Alteryx Portland, ME User Group forum is a sample workflow that does some simple data transformation on my personal Fitbit data and posts the results to Slack. This is a silly example, but can be easily adapted to more helpful use cases that involve job status/event notifications.