How To Set Up Pantheon Quicksilver Notifications for Slack

You’re right, this isn’t rocket science, and Pantheon’s Quicksilver documentation is pretty damn good.

But let’s just say I’m a rather straightforward guy and I just want to make things even more stupid simple for the next John Doe who happens upon Terminus workflows. After all, I just want our Drupal development team's work to be visible for both us and our clients.

Step 1 - Configure Your Slack Webhook

Remember: You have to do this for each organization, or project that you set up.

  1. Just go to your Slack organization’s incoming webhooks config.

  2. Grab the secret Webhook Slack URL, it will look something like

  3. Make sure that when you set up your Incoming Webhook, you don’t point it to a Private Group. (I ran into this issue with my own install, and was forced to create a public #quicksilver channel, even though our organization mostly operates with private groups).

Step 2 - Store Your Slack URL in a Secrets.JSON

Remember: This Slack URL is unique for each Webhook you set up!

Again, Pantheon has some great documentation on these steps, so you can take a look here for the most recent quicksilver examples for slack.

I’ve included those steps here just to make this even more stupid simple.

  1. $> echo '{"slack_url": ""}' > secrets.json
  2. # Note, you'll need to copy the secrets into each environment where you want to trigger Slack notifications.

  3. $> `terminus site connection-info --env=dev --site=your-site --field=sftp_command`
    Connected to
    sftp> cd files
    sftp> mkdir private
    sftp> cd private
    sftp> put secrets.json
    sftp> exit

#2 is critical people, get to ftp’ing.

The good news is that after you do this initial saturation of secret JSONs, you can count on workflows (copying one site’s files to another) to pollinate your field of servers with Quicksilver’s Slack-bees.

(I know, that was a terrible metaphor… Let’s move on)

Step 3 - Set up the pantheon.yml with Quicksilver actions

Pantheon’s example can be found here: example.pantheon.yml. The YML file contains a bunch of references to quicksilver scripts that Pantheon simply doesn’t provide in their quicksilver-examples repo. ([Q_Q]).

So, I just pared things down until I had something that would work OOB with very little customization. Here is my pared down version of the pantheon.yml:

api_version: 1

 # Commits: Notify team of new commit to master (dev)
     - type: webphp
       description: post to slack after each code pushed
       script: private/scripts/slack_after_code_push.php

 # Code Deploys: Notify, and notify completion
     - type: webphp
       description: post to slack before deploying
       script: private/scripts/slack_before_deploy.php
     - type: webphp
       description: post to slack after each deploy
       script: private/scripts/slack_after_deploy.php

Step 4 - Set up the scripts in /private/scripts of your Repo

The documentation was a bit confusing to me (maybe because I was trying to work through it at the end of a 12 hour day for some fun), and so don’t mix up where you store your secrets.json and this /private folder. This one goes in your repo.


  1. Copy slack_deploy_notification.php to /private/scripts

  2. I renamed this file as slack_after_deploy.php because that’s what Pantheon used in the example.pantheon.yml and it made sense to me to adopt their example workflows.

  3. I then duplicated it to slack_before_deploy.php and customized the message to account for this before and after.

  4. Copy slack_sync_notification.php to /private/scripts.

  5. You can then customize it as you see fit: I made sure to add in some funny slack :emojis: though to the notification messages—because who doesn’t want to see this :concentrate: emoji next to every commit?


<< Fork my slack-emojis repo on GitHub >>

Step 5 - Push, Push, Baby!

The Quicksilver hooks won’t fire until they are already there on the instance, so don’t expect a magical unicorn to show up in your Slack channel the first time. Perhaps the second time—if you didn’t mess anything up!

Pantheon Quicksilver Example

Step N - Troubleshooting

At first, I couldn’t get any of my messages to display, and there weren’t any alerts in error logs. Eventually I figured out I could check for workflow messages by checking the workflows queue from the CLI:

$ terminus workflows show --site=my-site-not-yours

… (Some list is returned, it’s long)

2. dev - Sync code on "dev" - 2016-01-20 22:39:26 - a8dbc908-bfc6-11e5-bbf1-bc764e10d7c2

… (Pick a task # where your code has already been pushed up and your secrets.json stored on that instance)

Choose workflow: 2 // You are prompted to input this

| Key | Value |
| Id | e550e8f4-bfa4-11e5-8b9c-bc764e10d7c2 |
| Env | dev |
| Workflow | Sync code on "dev" |
| User | Pantheon |
| Status | finished |
| Time | 26s |
| Type | Operation Description | Result | Duration |
| platform | | succeeded | 0s |
| platform | | succeeded | 16s |
| quicksilver | post to slack after each code pushed | succeeded | 7s |
------ Operation: post to slack after each code pushed finished in 7s ------
==== Posting to Slack ====
RESULT: Invalid channel specified
===== Post Complete! =====

What I learned here is that I can’t post to a private Slack channel, even though the Incoming Webhook handles that authorization. My only guess is that the PHP script doesn’t handle the formatting for private Slack channel names, and I will have to troubleshoot it later. Or someone else will, when they come across the same bug.


Jordan RyanJordan Ryan (@jordan_ryan) is President and Solutions Architect-for-hire at Facet Interactive (@FacetLA). When Jordan isn't hustling through his most recent discovery engagement, you can find him enjoying the finer grinds of fresh ground coffee in Santa Monica or fiending for a foodie fix wherever Yelp may take him. Follow him on Instagram if you like to feast with your eyes.


Let's Talk About Wasting Less Time

[mauticform id=5]