Zapier - Setup and configuration
- A familiarity with how Zapier works, as well as a free Zapier account.
- The Zapier Pro Add-on has two parts; the plugin you install on your site, and a Zapier app we've made in the Zapier app marketplace. While the AffiliateWP Zapier app is in Beta, you'll need to use our invite code to add the AffiliateWP Zapier app to your Zapier account. Click here to accept an invite for the AffiliateWP Zapier app.
Basic set up
After installing and activating the Zapier pro add-on, visit the Affiliates → Settings screen, and click on the Zapier tab. Enable the add-on by checking the Enable Zapier checkbox:
Don't see anything? The Zapier pro-add on requires AffiliateWP 1.9 or later. If you've installed and tried to activate the Zapier pro add-on and don't see the Zapier tab in the AffiliateWP settings screen noted above, that means you'll need to update AffiliateWP first, to version 1.9 or later.
Triggers or Actions?
Read more about how The AffiliateWP Zapier add-on works, what it can do, and more in our guide How does the AffiliateWP Zapier add-on work?
Below, examples are provided for both triggers and actions.
Let's start with a trigger to get things going. Follow the guide below to set up your first AffiliateWP Zapier trigger.
1. Check the checkboxes next to the triggers you'd like to enable for use within Zapier. The options available are:
For each of the items above which you enable, you can create Zapier triggers for any of the following events:
- Any item is created (such as "New Affiliate")
- Any item is updated (except Payouts, since they can't be edited)
- Any item is deleted
For example, if you enable Affiliate triggers, you'll be able to trigger a Zapier event on any of the following conditions:
- Whenever an affiliate account is created on the site, whether added by an administrator manually, or via an affiliate registration, Zapier is notified, which can then be used to trigger something else in Zapier.
- Whenever an affiliate's account information is updated in any way on the site*.
- Whenever an affiliate is deleted on the site.
The same can be done for referrals, visits, creatives, and payouts! However, payouts cannot be edited, so the payout updated option is not available for payouts.
*Except when re-calculating affiliate earnings due to a referral being altered, such as a referral rejection. This is done by AffiliateWP any time a referral is changed, so that affiliate information always stays accurate and up-to-date.
Connecting your WordPress site with your Zapier account
AffiliateWP will only authenticate with the API keys method defined in this setup guide below. Despite there being a Zapier App called WordPress on zapier.com, which allows for various generic functionalities on a WordPress site, it does not authenticate with AffiliateWP, nor does it provide any functionality for AffiliateWP.
First, let's get the rest of the set up completed, then we'll create an example zap!
2. Now, select the desired AffiliateWP trigger (or action if you happen to be creating an action). There are numerous options, but authentication is the same for both triggers and actions.
Available triggers are:
- New Affiliate
- Affiliate Deleted
- Affiliate Updated
- New Referral
- Referral Deleted
- Referral Updated
- New Visit
- Visit Deleted
- Visit Updated
- New Creative
- Creative Deleted
- Creative Updated
- New Payout
- Payout Deleted
Once you've selected the desired trigger, click Save + Continue at the bottom-right of the screen.
3. Click Connect A New Account, and a pop-up window from Zapier will open.
4. To get the information Zapier is requesting, we'll need to head back to your site where AffiliateWP and the Zapier add-on are installed. Keep this Zapier window open - we'll get back to it in just a moment.
5. On your site, go to Affiliates → Tools, and click on the API Keys tab.
6. In the input field at the top, enter the username of an admin user on your site you'd like to use for authenticating with Zapier. Once the correct username pops up, click the Generate New API Keys button.
The API key must be created for a user that has the necessary capabilities. An admin user is the recommended choice.
7. You'll receive something that looks like this, but the values in each key will be unique.
8. Copy the public key and head back to that Zapier pop-up window. Paste it in the field labeled Public Key.
9. Now do the same for the Token field.
10. Lastly, add your site url. If you're not sure of the site url, this can be found on the main WordPress settings page, Settings → Site Address.
11. Once everything is filled out, click on the Yes, Continue button at the bottom of the pop-up window.
12. You should now see your site selected, similar to the screenshot below.
13. Click Save + Continue. Now, let's test to make sure things are working before we create the zap.
Click on Fetch & Continue.
14. Now we'll create the action, where we can choose what to do when Zapier receives AffiliateWP data from your site. Because of the virtually infinite combinations in which you can integrate apps on Zapier, you'll possibly see things that look a little different from what you're seeing within this guide. However, the same principle applies for all Zapier triggers: you'd now like to do something with the information AffiliateWP is providing to your Zapier account.
In this case, the action is to create a Slack message (Slack is a messaging app used for communication and notifications, and is one of the over 700 different apps available on Zapier). In this example, the content of a new Slack message is filled with data from a New Affiliate registration.
The AffiliateWP fields are available within a drop-down menu of trigger fields. Zapier shows one item from your site (usually the latest one to occur) as an example of how things will look once the zap is created:
15. You'll have the option to test this step as well. Once the step has completed (or if you prefer to skip the test), you're given the option to name the zap, and turn it on. This zap will now trigger on any valid AffiliateWP event.
16. All finished!
Zapier actions allow things in AffiliateWP to be created, updated, or deleted on your site; they're the opposite of triggers. You can learn more about Zapier actions and how they work within the AffiliateWP Zapier add-on by reading our guide How does the AffiliateWP Zapier add-on work?.
Actions, Example One: Creating an Affiliate
Now, let's create an action in Zapier. For this example, you'll need a free Google Drive account. We'll be using Google Sheets to create a spreadsheet. When data is added to that spreadsheet, Zapier will pick it up, and create an affiliate on your site using that data.
1. Create a spreadsheet containing affiliate data you'd like to be entered into AffiliateWP. For this example, you can copy the one we're using here at this link, or use it as a starter template to create your own.
Make sure to specify, at a minimum, the affiliate payment email, which is required to create an affiliate. The username of the WordPress user can be provided, with the username field. If no username field is provided, the username will be generated using the payment email.
Please note that the data contained in the spreadsheet is fictional, and is provided for example usage. You'll need to copy the spreadsheet to your own Google account so you can change the data.
Here's what our example spreadsheet looks like:
2. Great! Now that we've got that spreadsheet loaded up, let's go to Zapier and log in, and create a Zap.
3. This time, the first step, the trigger, will be Google Sheets. Start typing it in the trigger input area:
4. Select New Spreadsheet Row, click Save + Continue, connect your Google account, and click Save + Continue again.
5. Now let's tell Zapier which spreadsheet to use. If you're using a copy of the example spreadsheet linked to above, select Affiliate as the spreadsheet name, and Create Affiliate as the worksheet name:
6. Just like the AffiliateWP trigger we set up in the Triggers section of this guide, Zapier will ask if you'd like to perform a test. Perform the test if you like, then click Fetch & Continue:
7. Just like Zapier triggers, there are many options here. For this example, we're going to use Create Affiliate, because we want to create an affiliate on your site any time a spreadsheet row is created in the previously-selected Google Sheets spreadsheet.
Available actions are:
- Create Payout - Creates a payout in AffiliateWP.
- Update Visit - Updates a visit in AffiliateWP.
- Create Visit - Creates a visit in AffiliateWP.
- Create Affiliate - Creates an affiliate in AffiliateWP. This also creates the required WordPress user account. Payment email is required.
- Delete Creative - Deletes the specified creative in AffiliateWP.
- Create Referral From User ID - Creates a referral in AffiliateWP.
- Create Referral From Username - Creates a referral in AffiliateWP.
- Create Affiliate From User ID - Creates an affiliate from an existing WordPress User ID. An existing WordPress User ID must be specified.
- Delete Visit - Deletes the specified visit in AffiliateWP.
- Create Referral From Affiliate ID - Creates a referral in AffiliateWP.
- Create Creative - Creates a creative in AffiliateWP.
- Update Referral - Updates a referral with the specified data.
- Update Affiliate - Updates an affiliate account with the specified data.
- Delete Referral - Deletes a referral.
- Update Payout - Updates a payout with the specified data.
- Delete Payout - Deletes a payout.
- Delete Affiliate - Deletes an affiliate.
- Update Creative - Updates a creative in AffiliateWP.
8. Select the Create Affiliate trigger, click Save + Continue, and connect your AffiliateWP account using the same method noted above.
9. Now we'll need to map fields from the Google spreadsheet to the matching AffiliateWP fields. If you're using the provided example spreadsheet noted in earlier steps within this guide, the names should match up. Select each field you'd like to be sent to AffiliateWP, to be used when creating an affiliate.
Here, you can specify the username, if you like. If not, the payment email will be used to generate the username. Please note that the payment email field is required:
10. Now Zapier will again ask if you'd like to test this step. Test things out, if you like, then the zap is ready to create!
11. To test the zap at any time, you can create a new spreadsheet row in your Google spreadsheet. Zapier will detect it either every five minutes, or every fifteen minutes, depending on the type of account you have. You can also select Run from the dropdown menu for this zap on your Zapier dashboard at any time:
12. That's it!
Actions, Example Two: Updating an Affiliate when a Subscriber is Updated in MailChimp
If you've followed the first actions example above, now affiliates can be created from any Zapier trigger. That's great, but what if data for an affiliate changes? How will AffiliateWP have accurate information? By using another zap to update the affiliate, that's
In this example, we'll create a MailChimp trigger, and then use a different AffiliateWP action - the Update Affiliate action.
1. Create an account (or log in to an existing account) at mailchimp.com.
2. Select MailChimp as the trigger source, and select Updated Subscriber as the trigger:
3. Click Save + Continue, then connect your Zapier account to your MailChimp account:
4. Click Save + Continue, then select your desired list:
An important note about custom fields
Before going further, let's take a moment to explore what information is required by AffiliateWP for the Update Affiliate action, what fields are available in your MailChimp list already, and discover how to add some new custom fields within MailChimp.
By default, any subscribers imported into MailChimp will only have fields which are already defined in MailChimp imported. These are usually first name, last name, and email address.
AffiliateWP requires either the Affiliate ID or the associated WordPress user ID in order to update an affiliate. Make sure to define this field in MailChimp.
If, for example, you wished to import the affiliate rate, or status, or other information into MailChimp, you'll get a notice indicating that the fields must be skipped, since there's no MailChimp field in which to place it:
However, you can create as many custom fields as you like, by going to Settings → List Fields and MERGE Tags in the selected lists menu:
At a minimum, create the Affiliate ID field (or a field to provide the associated WordPress user ID of the affiliate):
With the exception of the Affiliate ID (or associated WordPress user ID), which is a required field for the Update Affiliate action (noted above), you don't need to create any additional custom fields in MailChimp in order to use it with AffiliateWP, but it sure makes it a lost more powerful.
We use this very zap here at AffiliateWP every day, which helps us keep affiliate information updated in multiple places, automatically. Here's an example of fields you may choose to include - which are all listed when creating a zap in Zapier:
When importing subscribers, the newly-created fields will now be available to map. You can also create new field columns here as well, if you like:
5. Once you have the list how you'd like it, if it's a new list, you'll need to import subscribers.
Import a single subscriber:
Import multiple subscribers:
You'll get something like the screenshot below once you're done. Click Finish when you're ready to import the list.
6. Now let's connect the MailChimp data to AffiliateWP. Zapier will again ask if you'd like to test your step before continuing.
Notice that for any custom MailChimp fields you've created, they'll be prepended with merges__, which is followed by your custom field name:
Make sure that the Affiliate ID (or associated WordPress user ID for the affiliate) is being seen by Zapier:
7. Click Continue, then select AffiliateWP as the Action App:
8. Choose Update Affiliate as the action, and connect your AffiliateWP account as noted above.
9. Map the Affiliate ID field you set up in MailChimp to the corresponding AffiliateWP required field, and click Continue:
10. Zapier will ask if you'd like to test this step as well. Test if you like, then create the zap! Like the other examples, this can be triggered either every five minutes, or every fifteen minutes, depending on your Zapier.com account plan. It can also be triggered manually at any time by clicking Run in the zap context menu in your Zapier.com account dashboard.
11. That's it!