We take advantage of lots of different services at Pusher: Zendesk for support, Intercom for CRM, Base CRM for sales leads, KISSmetrics for analytics, Google Apps for email, docs and much more.

Doing this allows us to focus on listening to our users, improving our service, developing and maintaining libraries for multiple languages, and creating developer tools that make it easier to build and debug real-time apps.

But what do we do when we want to take data from one application or service and plug it into another? For example, data from Intercom in Base CRM.

Do we build a custom app that fetches the data from the first service, filters and manipulates that data and pushes it to another service? Do we spin up a server instance and script repeatable build and deployment steps? No. We use Zapier. As the Zapier website quite rightly puts it:

Zapier connects the web apps you use to easily move your data and automate tedious tasks.

It does. And it does it really well.

Pusher now Available in Zapier

It won’t surprise you that at Pusher we want to know exactly what’s happening right now in all our apps and services. So we’ve written a Pusher integration that makes it easy for us to publish an event via Pusher the instant anything happens in any other services that we use. Dashboards showing sign-up stats for the day via our Intercom integration, live account subscription notifications via Chargify and we plan to use Travis Webhook integration to build status notifications for our open source libraries. We can do all this without a single microservice or server that we need to maintain ourselves. We simply set up the Zap, write some client-side JavaScript, and we have a bunch of really useful real-time dashboards.

And today, we’re making the Pusher application integration available to all Zapier users!

Creating a Zap that uses Pusher

As a demonstration let’s Make a Zap! which reads data from an email and publish an event, sending the subject and body via Pusher to a web UI.

First, create a zap and choose “Email” as the Trigger app and for the Trigger choose “New Email Matching Search”. For the Action app choose Pusher and choose the “Publish Pusher Event” Action.

1-setup

Next you’ll need to select a Pusher application (assuming you’ve signed up) that you’re going to be publish events through. You don’t actually need to authorize a particular Pusher account since having the application credentials is enough to prove you are authorized to use an application within Pusher. So, enter the Application Id, Key and Secret values from the Pusher Dashboard for the application you wish to use.

2-pusher-credentials

Hint: it can be useful to put the Application ID in the “Name this connected Pusher account on Zapier” field for quick reference

You’ll next be prompted to enter an email address so that Zapier knows any incoming email to that address is for the Zap you are creating.

3-email-address

For the next step you need to set up your “Publish Pusher Event” details. To publish an event via Pusher you need to provide three pieces of information;

  1. the name of the channel the event is to be published upon
  2. the event name and the data payload. Let’s go with email as the channel name and new_email as the event name.
  3. the event data. For this we get to use key/value selectors which will result in us building a JSON payload. Create two fields: a subject and choose Subject via the “Insert Fields” helper, and a body using Body Plain.

4-pusher-trigger-setup

Finally we get to test that the Zap works. Upon clicking the “Test Email Trigger” button you’ll be prompted by Zapier to create some sample data to help with the test. Follow the simple instructions and once you have the sample data you can now trigger the Zap, and the event through Pusher.

To check this works is as simple as using the following script in a web page and clicking the “Test Zap with this sample” button.

var pusher = new Pusher('YOUR_APP_KEY');
var channel = pusher.subscribe('email');
channel.bind('new_email', function(data) {
  alert(data.subject);
});

Finally, give your Zap a name and save it.

You can now test this out yourself by email the address you set up. Or you can test one we made earlier by sending an email to pusher.3bgb4@zapiermail.com and the result will appear in the activity stream below.

This is email, so it might take a bit of time (up to 40s during tests) for it to interwebs ⇢ Zapier's email servers ⇢ Pusher ⇢ this page. But, the point of this example is to show how easy it is to create a Zap. There are other sources of data that you can set up that update much faster. So, have a play with those and see what you can build.

A Note on Security

We’re a fun yet pragmatic bunch at Pusher. So we understand that the data you’re sending through Zapier and Pusher may be private. All you need to do to add a layer of authentication to the above process is to give the channel name a private- prefix (i.e. the channel name will be private-email) and configure your Pusher client to be aware of an authentication endpoint that you control so you can make sure the user that is subscribing to your data has the right to do so. For more information see the Private Channels and the authentication docs.

Conclusion

Taking data from one application and using it in another used to be much more painful. Zapier integrates lots of services together, taking the pain out of building and maintaining small dedicated services. Now, with Pusher integration you can easily integrate data from a whole host of supported apps – or any apps that expose WebHooks or have an endpoint you can poll – and use that data directly in your web, mobile or IoT applications.

To help you get started here are a number of examples Zaps which connect Pusher with GitHub, Jira, Twilio, PagerDuty, PayPal, Stripe and Twitter, with many more possibilities just a few clicks away.

About Phil Leggetter

Phil Leggetter is a head of developer evangelism at Pusher. He's been building and using realtime web technologies since 2001 and is excited about the use cases and the potential for the technology as ever.