By Zapier: Sub-Zaps and how to use them

  • 6 September 2021
  • 5 replies
  • 4758 views
By Zapier: Sub-Zaps and how to use them
Userlevel 7
Badge +11

Hey again, Zapier fans! In this article I'm going to explain what Sub-Zaps by Zapier is, how it works, and give some examples of workflows that you could build. Let's jump in!

What It Is

This app enables you to build reusable Zap components and systems by building and calling "Sub-Zaps".

Ok, but what does that mean? 

When you build a Zap that has the Start a Sub-Zap trigger, it becomes its own workflow that you can "call" (connect to/send information to) from other Zaps.

Still confused? Here's a quick example: 

https://community.zapier.com/featured-articles-65/an-example-of-using-sub-zaps-by-zapier-to-retrieve-an-access-token-11001

Don't be afraid of the use of the words "access token". In a nutshell, I had a process that I needed to use each time I wanted to perform certain actions (retrieving an access token) in a Zap. I could either create this in each and every Zap, which is not quick or obvious to do, or build a Sub-Zap one time that has everything I need, then "call" that Sub-Zap when I need to retrieve an access token.

Trigger (1)

Start a Sub-Zap (Instant)

Triggers when an outside Zap calls this Sub-Zap. Always used inside of a Sub-Zap. A later step in the Sub-Zap should be the "Return from a Sub-Zap" action.

Actions (2)

Call a Sub-Zap

Used outside of a Sub-Zap, this will activate a Sub-Zap, which should contain both the "Start a Sub-Zap" trigger and "Return from a Sub-Zap" action.

Return From a Sub-Zap

Used inside of a Sub-Zap, this is the final step of a Sub-Zap and should be after the "Start a Sub-Zap" trigger.

How It Works

A Sub-Zap in and of itself can't really do much, since you have to "kickstart" it from another Zap. You can think of it as a parent Zap (the one that calls the Sub-Zap) and a child Zap (the one that is triggered by Start a Sub-Zap).

Sub-Zap: Extract an email address, split first and last name, and use a Lookup Table to output a specific value.

Parent Zap #1: Triggered by Google Forms submission, calls the Sub-Zap, then adds the person to HubSpot.

Parent Zap #2: Triggered by Facebook Lead Ads form submission, calls the Sub-Zap, then adds the person to HubSpot.

Parent Zap #3: Triggered by Unbounce landing page submission, calls the Sub-Zap, then adds the person to HubSpot.

As you can see, adding the three steps that are in the Sub-Zap to each of the "parent" Zaps above would have been tedious.

BONUS: If you need to make a change to the steps in the Sub-Zap, you can do it one time instead of finding all of the Zaps in which you added those steps.

What You Can Build With It

It might be easiest to understand if we go through an example and include some screenshots to illustrate the process :)

Example: Extract Email, Split Full Name and Use Lookup Table

Let's use the example we introduced above, where we have input from a source (regardless of what that source is) and we want to do the following:

  • Extract an email address from a field that may also contain other text in it

  • Split a full name into first name and last name

  • Use a Lookup Table to look at a location field and output the appropriate ID that our CRM app will need

The Sub-Zap

Let's start by looking at the Zap that will be doing most of the work (the Sub-Zap). The trigger will always be "Start a Sub-Zap". This is where we create the inputs that will be used inside the main Zap, to map fields that can then be processed by the Sub-Zap.

0a5a74ebf8963c61a63c9d9fa11094d9.png

First, we'll use a Formatter step to extract the email address. In this case, let's say that we've had people adding more than just their email address in the form. We want to isolate the email address for later use in our CRM.

768d9276950142e2c57539cabf1c1b56.png

Next, we'll add another Formatter step to split the full name from our main Zap into separate fields (first and last). There are some edge cases where names contain a middle name, or two-part last name, but for demo purposes it's a first and last name that we're splitting.

c452575ace1fe8408732cbbd487e99e5.png

Finally, we'll use a Lookup Table to turn the words "Product A" into the Product ID that our CRM uses. If we try to pass "Product A" into the CRM, we'll get an error message since that's not something that it will recognize.

d0e1825430e35c84aa8983ccc240b0d5.png

The last piece is to send all of these values back to the main Zap. You can name the values anything you'd like, as long as it will make sense to you when you receive it in the main Zap. You can see that I've mapped all of the output from my various Formatter steps, and used descriptive labels for them (email, first name, last name, product ID).

bc252d15e2bcb8035a8caf692233ce09.png

The Main Zap

For demo purposes, I used a Code step to create the values I needed, but this would be your form step (for example). As you can see, when I specify which Sub-Zap to use, the fields that I'd set up are available for me to map values from my trigger step. Neat!

LJR7J3gHlEWmm0wl5ZsKAfwFCx8uyulodlq9eYeFYaaJWVQzWSH74iXIdQ1rnc-WI9ugdAoQbHEgTB3FnR7DdxN5Mp9qEYNXvr1doikNpp2feRBCAeEFBDLKArgD0p6v0sSTFPGj=s0

When I test the step, I receive the values that were processed by my Sub-Zap.

79cb6692cbfdcacbcb090da01a65a708.png

Example 2: Searching Multiple Apps to Retrieve Contact/Lead Data

Let's say that you've got 5 different places where you collect information about contacts/leads and when your Zap is triggered you want to search all of them in order to retrieve data for a final step in your Zap. It would be tedious and untenable to include all 5 of those steps in each Zap that you build. Instead:

Main Zap: The trigger step that contains an email address, the step that calls the Sub-Zap, and one last step where you send out an email with the information you've gathered from the various sources.
Sub-Zap: Receive the email address from the Main Zap, search apps 1, 2, 3, 4, and 5 for the data you need, send it back to the Main Zap (where it will be compiled into an email). 

Example 3: Send Data to More Than 1 Sub-Zap

Now we're getting pretty advanced! What if instead of just looking for information about contacts/leads, you'd also like to retrieve a file from Google Drive, Dropbox, etc. You could put that step into Sub-Zap #1 but others at your company need to find files without all of those extra steps from your first Sub-Zap. 

So it exists as a separate Sub-Zap that you can add to your Main Zap:

75803180ac647c7d4eafe40587e38f4d.png

Wrapping Up

Hopefully this helped you see the potential and power of using Sub-Zaps in your workflows. If you still have questions, or anything is unclear, please don't hesitate to comment below or create a new topic in the Community.


5 replies

Userlevel 1
Badge

Very helpful, thanks, I created my first subzap successfully with your help.

Userlevel 7
Badge +12

That’s awesome, @Patrick.emin! What does it do?

Userlevel 1
Badge

@Danvers I am using several “manual Zaps” (Zaps started with the Chrome web extension) that all in their workflow push a message to Buffer so they are later published on my Social channels. Instead of repeating the same three steps (I have three social channels) for each of my manual Zaps, I call a single sub Zap that does that. When I will have to change something in my social channels in Buffer, like adding or removing a channel, I will have only that sub Zap to edit.

Userlevel 7
Badge +12

That’s a great idea! I’m so glad that sub-Zaps are helpful for you 😄

I have several Zaps which trigger when a submission is made to Gravity Forms. Each Zap adds a record into Pipedrive. 

These existed before I became involved.

Current requirement is to add a step to those Zaps so that a new row in a Google Sheet is created.

My thinking is to put this into a Sub-Zap so that the addition to Google Sheets only has to be coded once.

But I would need the details from the Gravity Form submission (all of them).

I have read that there is a way of passing the ID of the required step ie Gravity Forms to the Sub-Zap and then having the Sub-Zap retrieve the actual fields.

Where can I find out more about how to make this work?

Reply