An example of using Sub-Zaps by Zapier (to retrieve an access token)

  • 12 August 2021
  • 0 replies
  • 583 views
An example of using Sub-Zaps by Zapier (to retrieve an access token)
Userlevel 7
Badge +11

Heyo Zappers! This week's Workflow Wednesday post will be a pretty quick one. I wanted to show an example of a way to use Sub-Zaps by Zapier in order to simplify a tedious process.

The Challenge 

Sometimes an app integration doesn't do what you need it to, so you venture into API territory. In this example I'm using Webhooks by Zapier and I need an access token when making an API call. 

Tedious Way #1

You could copy some master Zap that contains the exact Webhooks step you need, then change the other steps in the Zap as you see fit. It's better than option 2:

Tedious Way #2

Recreate the Webhook step each time, by looking at a Zap or something in a document you've saved. Yes, the rest of the steps will be exactly what you need, but there's a whole bunch of manual work.

A Better Solution

Wouldn't it be great if you could build a Zap that only retrieves the access token, then plug that value into the other Zaps that need said token? 

Enter Sub-Zaps by Zapier. They exist as standalone Zaps to which you can send data, process it in the sub-Zap, then send it back to the parent/main Zap. I have another Zap that goes through the process of creating and communicating with Sub-Zaps:

You can check that one out for a more detailed look. For the purpose of this article I'm going to explain my specific use case.

Our Community Platform's Integration Doesn't Have What I Need

We use a platform called inSided, and though they've got a Zapier integration and it's capable of doing some common things, it can't do all of the complex stuff that I sometimes come up with.

Check the API Documentation

I can see in their API docs that in order to authenticate with them, an access token is required:

3YfHVAT4Z9J55ehHAlT392fW7UHzpwNSJWnUcAieqlBZB0A1i2iHUy_tpLy0wOe1Z0xnZD80St19R9ghJxJJoFqhl9ZSlxfNfcPwjpHtCOBmn6IzIL4km5tUrQk5HHS7ajF4JAm3

Getting the Access Token

Based on what they show in their documentation…

a2rh51u8RalsFp9njFbxWHs_fnj0Ww1iPDg3m35VeqkCH8a4rfheGNQDpYa6f9I26NOYOvayWuN2a5oW3b8Kh35Kij6LxKgsixdA_p5eyDDZf_HwpRQpA-5UT1ddtf6YCcCBVTDp

I can do the following in my Sub-Zap:

HKCpsoAStKgj5-LLUtuu-GrZkWxTmfxwSoFUqh38Htlag-Hd3UpJG_FdfjOzOXynSC2iJaUiTsmqJ0tOlCO4uDv0pEhP0VdJYRCuK02PKUit6tm6XhCnW99GMOxqsvXxmZoMqFt1

Sending the Token to the Main Zap

This is how it looks in the Zap, when I use the output of that Webhooks step to send the token back my main Zap:

um7ak3lHDXOHkay-dt86Nbao9NO1RsaIytNEUIq6OGumXR-ViHE8fzieNq75SXMZbSCHFHbyjTSIqXs1htuKTEl66fFvVgRiRE_hwrxJ19j1WGA5hXEw4k72DAnRmrIYXAPw4PLB

Meanwhile, in the Main Zap

You can see the Sub-Zap and the next step, in which I will use the token that was retrieved by the Sub-Zap:

HDJnME-ohG2SIjPdZ9R3E1U1LAMqjFWbzng4H4YemDyExTHOUPgfyyF3NZPAgGRTt8xHmR8tJm7yuu_ZLlqFSfteoCIMSQ9r0au08LYwpX2ivyjStHni0GB71bwG_u32joHJr61a

Then I map the output of that Sub-Zap like this:

GEqWk-ez5NuKqCJg4N1z_uom0f8K04l4sY0e3g9RzjfSKdOCAgGipITbvMBfF9u7PLnVKBOvgAOWu6SJzyw_I8giyUZ0k_tKmD0cNtWQnCYNEpFCfh7Xf9LVOJfWR6D1O1d4YZsK

Beyond Just Personal Use

One of the beautiful things about a Sub-Zap is that if I make it a shared Zap, then other members of my team can use it to get an access token. It's one less thing they have to worry about, and all of the requests for tokens can come from that single Zap (instead of however many Zaps we build that need the token).

In Conclusion

I hope this has shown you one way that you can take advantage of Sub-Zaps by Zapier, to make building your Zaps just a little bit easier. Until next time, happy Zapping!


0 replies

Be the first to reply!

Reply