AffiliateWP Automations
How to Send a Webhook When an Affiliate Earns a Referral in AffiliateWP
Sometimes the next step lives outside WordPress, in an accounting tool, a CRM or a no-code platform. To send a webhook when an affiliate earns a referral in AffiliateWP, use Zapify's An affiliate earns a referral trigger with the Send a webhook action. AffiliateWP is a Zapify PRO integration.
What this automation does
The automation is one trigger plus one action:
- Trigger: An affiliate earns a referral (
AFFWP_REFERRAL_CREATED, AffiliateWP) - Action: Send a webhook (
WEBHOOK_SEND, Webhooks)
Each time a referral is created, Zapify posts the affiliate and referral details as JSON to the URL you choose.
PRO feature
AffiliateWP is a Zapify PRO integration, so this automation needs an active Zapify PRO licence.
No Connection needed for AffiliateWP
AffiliateWP runs on your own site, so there is no API key to paste for it and nothing to set up under Settings → Connections.
Before you start
- AffiliateWP installed and active.
How to build the automation
Step 1: Create a new automation
- In the WordPress admin, go to Zapify → Automations.
- Click Add New to open the builder.
- Name it clearly, such as Send referrals to another system.

Step 2: Add the "An affiliate earns a referral" trigger
- Click Add Trigger.

- Choose AffiliateWP as the app.

- Select An affiliate earns a referral.

- Configure the trigger:
| Field | Required | What it does |
|---|---|---|
| Referral type | Yes | Any type, or one of Sale, Opt-in or Lead. Types added by an AffiliateWP add-on appear here too. |
| Source | Yes | Any source, or the integration the referral came from, such as WooCommerce, Easy Digital Downloads or MemberPress. |
| Product ID | No | Only referrals that include this product, matched by the product's ID. Leave empty for every product. |
| Run for | Yes | The affiliate (the default) or The referred customer. This decides whose details the automation uses. |
Leave the filters on Any, or narrow them. Keep Run for on The affiliate.
Step 3: Add the "Send a webhook" action
- Click Add Action.

- Choose Webhooks as the app.

- Select Send a webhook.

Step 4: Configure the action
| Field | Required | What it does |
|---|---|---|
| URL | Yes | The endpoint to call. |
| Method | Yes | POST is the usual choice. |
| Headers | No | Extra headers. Values may contain tokens. |
| Body | Yes | JSON fields is the safe choice. Zapify builds the JSON, so a value containing a quote cannot break it. |
| Fields | Depends | The key and value pairs of the body. |
| Authentication | No | None, Bearer token, or Username and password; or pick a saved auth profile. |
Set the Method to POST and the Body to JSON fields, then add fields such as:
referral_id: the Referral ID tokenamount: the Referral amount tokenaffiliate_id: the Affiliate ID tokenaffiliate_email: the User email tokenorder: the Referral reference (order ID) token

Step 5: Set the steps Live and save
Each trigger and action has its own Live / Off / Draft switch. A new automation starts as a Draft and does nothing until its steps are Live.
- Set the trigger and every action to Live.
- Click Save.

Step 6: Test it
Make a test purchase through a test affiliate's link and check that the receiving service got it. Zapify → Logs shows the request and the answer.
Tokens you can use
The trigger offers the affiliate's details, the referral's details, and the user tokens.
| Token | What it holds |
|---|---|
| Affiliate ID | The affiliate's numeric ID in AffiliateWP. |
| Affiliate status | Their status: active, inactive, pending or rejected. |
| Affiliate referral URL | Their personal referral link, ready to put in an email. |
| Affiliate payment email | The address they get paid at. |
| Affiliate rate / Affiliate rate type | Their commission rate and whether it is a percentage or a flat amount. |
| Affiliate earnings / Affiliate unpaid earnings | What they have earned in total, and what is still waiting to be paid. |
| Referral ID | The referral's numeric ID. |
| Referral amount | The commission earned. |
| Referral type / Referral status | Sale, opt-in or lead, and the status it has now. |
| Referral context | The source of the referral, such as woocommerce or edd. |
| Referral reference (order ID) | The order or record the referral was earned from. |
| Referral description | The description AffiliateWP saved with it. |
| Referral products | The products on the referral, as a readable list. |
| Referred customer email | The customer's email, when AffiliateWP recorded one. |
| User ID / Username / User email | The user the automation runs for: the affiliate, or the referred customer when Run for is set to the customer. |
| Display name / First name / Last name | Their name details. |
Conclusion
With the An affiliate earns a referral trigger and the Send a webhook action, AffiliateWP data can go anywhere. To go the other way and create referrals from outside, see creating a referral when a webhook is received.
FAQs
Is this free in Zapify?
The Send a webhook action is free, but the AffiliateWP trigger is part of the AffiliateWP PRO integration and needs an active Zapify PRO licence.
Can I send it to Zapier or Make?
Yes. Use the catch-hook URL they give you as the URL.
What if the receiving service is down?
The run is logged as failed with the service's answer. See Webhooks for retries.
Do I need to write any code?
No. Everything is configured visually in the Zapify builder.