How To: Get a Push Notification When Your Heroku App is Deployed

Published Mar 16, 2016Last updated Jan 18, 2017
How To: Get a Push Notification When Your Heroku App is Deployed

If you’re like me, you probably have at least a few apps deployed on Heroku. And if you are taking advantage of their GitHub integration, there's a good chance you have at least one app that deploys automatically whenever you push to a certain branch. And if that's the case, you may have realized that there's a small, but important problem with that: when you push to GitHub, you no longer know when the app has finished deploying, because the whole post-deploy process now happens in the background, rather than in your terminal.

Sure, you can always log into your Heroku Dashboard, open the app, navigate to the "Activity" tab, and watch the progress from there, but who has time for that?

Ain't nobody got time for that

That’s right: nobody. So, here's the patented, "lazy programmer" solution: you set up a deploy hook. Heroku already supports several channels out of the box, such as Email, IRC, Basecamp, Campfire, and HipChat, but what if you use Slack, or you prefer a push notification instead? Well, then this guide is for you.

First, you're going to sign up for a free account at Zapier. This is a service very similar to IFTTT, but while the latter seems to be more prolific in their marketing, Zapier’s engineers have been busy creating more API integrations. Unfortunately, neither of the two list Heroku as supported service. But fear not, we can still make this work, because Heroku was nice enough to also provide a HTTP hook.

Second, you'll need some way to receive notifications. In this guide, I'll be using Pushover for that purpose, but you can also use InstaPush, Basecamp, or Slack for this purpose. Or, if you’re old school, you can even have an SMS send to your phone (come on now, it’s 2016, time to ditch that feature phone and get with it, grandpa).

Once you've created your account on Zapier, you'll see the dashboard, with a big orange "Make a New Zap" button. Click it. You should see the following screen:

enter image description here

Type “webhook” into the search box, and select “Webhooks by Zapier” from the autocomplete dropdown. You should see the following screen:

enter image description here

Select “Catch Hook” and click the “Save + Continue” button. You’ll see this screen next:

enter image description here

We don’t need this part, so just click the “Continue” button. Now you will see this:

enter image description here

The textbox contains a randomly generated URL, which is where Zapier will receive notifications from Heroku. Copy this URL to your clipboard and click “Ok, I did this”. Zapier is now waiting for Heroku to send it some sample data to verify that the hook is working.

Next, we'll have to do some setup in Heroku. Log into your Heroku dashboard, open your app, and under "Resources", type "Deploy Hooks" into the search box and add the add-on from there. Paste the URL you copied into the input box and click the "Save and Test" button. Now, go back to Zapier. It should now tell you that the test was successful.

enter image description here

On to the next step! Here, you will select the action that will happen when this Zap is triggered. I will be using Pushover in this example.

enter image description here

Click "Continue", select “Push Notification” on the next screen, and then select the Pushover account to use (or set up a new one)

enter image description here

Finally, here comes the fun part: this is where you set up the push notification. Pushover supports a lot of options. You can play around with these or just use the settings from my screenshot:

enter image description here

Note that if you set a URL, clicking on a push notification will take you to that URL right away. In other words, if you put the placeholder for your app’s URL in that field, tapping on the push notification will take you straight to your app. Neat!

Lastly, Zapier will ask you to test this step by sending a push notification to your account:

enter image description here

All you need to do now is set a name for this trigger and save it by clicking “Finish”. Voila, Heroku will now send you a push notification anytime your app is deployed.

Note: this article first appeared on my blog. Drop by for more tutorials and coding articles!

Discover and read more posts from Christoph Wagner
get started
Enjoy this post?

Leave a like and comment for Christoph

Be the first to share your opinion

Get curated posts in your inbox

Read more posts to become a better developer