Sending a push notification to your browser or mobile with ColdFusion and Push Engage

Push Engage is a service which lets you easily send push notifications to a browser or mobile phone, using a little code on your website. It’s very easy to set up and they currently have a very generous free account, allowing you to send a notification to up to 2,500 browsers/devices.

I’m using it as part of some alerts in the background of a client’s website. They’re using ColdFusion, so I needed to work out the code to send the alert from them, the API documentation on Push Engage has an example in PHP, but it’s very simple to convert. Here’s a CFHTTP call that will send a notification:

<cfset api_key = “(your API key here)”>

<cfhttp method=”Post”
url=”https://www.pushengage.com/apiv1/notifications”>

<cfhttpparam type=”header”
value=”#api_key#”
name=”api_key”>

<cfhttpparam type=”Formfield”
name=”notification_title”
value=”The text for the alert title”>

<cfhttpparam type=”Formfield”
name=”notification_message”
value=”The smaller text of the message of the notification”>

<cfhttpparam type=”Formfield”
name=”notification_url”
value=”http://www.example.com/”>
</cfhttp>

I’ve already followed their steps for adding Javascript to a page on the website, visiting it using a browser on my computer and my phone and accepting notifications from the site. Now, when I trigger the page with this on, I get a notification a few moments later. Lovely!

Thanks to Dave Child for introducing me to Post Engage.

 

Leave a Reply

Your email address will not be published. Required fields are marked *