Slack Notifications from Adobe Launch through LaunchBot
If you use Adobe Launch as a tag manager for Data Implementation, you already know that it has three broad environments: Development, Staging, and Production. Using the Launch UI, you can easily move your work (i.e. library) from development, to staging, and eventually to production. Therein lies a pitfall: Anyone with access to Launch can push libraries to production without peer review— you know, similar to how we have Pull Requests in GitHub.
I’d like to be able to set up notification rules associated with when a library is submitted for approval, approved, and published. Launch admins would be responsible for setting up notification rules & settings. Notifications could be sent to an email group and/or to a Slack channel. — Adobe Launch User
At Telus Digital, we’re constantly working in Launch and making new libraries, and no one has ample time to constantly check libraries being pushed to production. Typically, if a library gets pushed to staging, there is a high probability that it will end up in production. How about creating a bot that checks the staging environment — for the existence of a new or an updated library — and sends a Slack notification with a direct link to the library for peer review?
There are several reasons why this is ideal. One, we get to see what’s being built before it gets to production. Two, we can catch breaking changes before they get pushed to production. Three, having this automated saves everyone some time and makes our workflow more efficient.
Welcome, LaunchBot. LaunchBot is a backend tool built on Node.js by the Analytics Developers at Telus Digital. It leverages Adobe IO, Adobe Launch’s API, Slack Webhooks, and the Google Cloud Platform (GCP) to send notifications to Slack if changes in the staging environment in Launch are detected.
A cron job pings the staging endpoint in LaunchBot to kickstart the process. Here is what the process looks like.
First, we authenticate with Adobe IO to get the access token we need to make requests to the Launch API. Adobe has good documentation on how to get the credentials to authenticate with Adobe IO. These tokens expire after 24 hours, and we recommend that you generate them programmatically — Adobe has an npm package that makes this a breeze.
Second, using the access token, we make two GET requests to the Launch API. We start by making a GET request to the environments endpoint (passing the environment ID as a parameter — here, we use the environment ID of the staging environment). Using the response from that request, we extract the library ID of the library in staging. With that library ID, we make the second GET request, but in this case, we call the libraries endpoint (passing the library ID as a parameter).
Third, the response from the GET request to the libraries endpoint provides us all the data relevant to the library. There are several possibilities here: the library could be stale or recently updated or completely new. We check for each of these possibilities, and send a notification to Slack if the library is not stale.
Right after the notification hits Slack, we update our data storage platform — in this case, GCP’s Datastore — with the library information that was just sent to Slack. This way, we have something to compare against to avoid flooding Slack with stale libraries.
A bare-bones version of LaunchBot is available for public consumption on GitHub. Feel free to ping me if you have any questions. Enjoy!