AffiliateWP Automations
How to Create an AffiliateWP Referral When a Webhook Is Received
Not every sale happens in your WordPress store. To create an AffiliateWP referral when a webhook is received, use Zapify's free A webhook is received trigger with the Create a referral action. The affiliate gets credit for sales from a CRM, a payment platform or a script. AffiliateWP is a Zapify PRO integration.
What this automation does
The automation is one trigger plus one action:
- Trigger: A webhook is received (
WEBHOOK_RECEIVED, Webhooks) - Action: Create a referral (
AFFWP_CREATE_REFERRAL, AffiliateWP)
When the outside service sends a webhook, Zapify creates a referral for the affiliate named in it, with the amount and the order reference.
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.
- An outside tool that can send a webhook, and its documentation for what the webhook contains.
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 Record outside sales as referrals.

Step 2: Add the "A webhook is received" trigger
- Click Add Trigger.

- Choose Webhooks as the app.

- Select A webhook is received.

- Copy the endpoint URL the builder shows and paste it into the sending service's webhook settings. Treat the URL as a credential, because anyone who has it can send data to this automation.
- Click Listen, then send one test delivery from the service. Zapify captures it and builds the token list from the real fields, so you pick them rather than guess.
See Webhooks for signatures, sources and event types.
Step 3: Add the "Create a referral" action
- Click Add Action.

- Choose AffiliateWP as the app.

- Select Create a referral.

Step 4: Configure the action
| Field | Required | What it does |
|---|---|---|
| Affiliate | No | An affiliate ID, or the email of an affiliate's user. Leave empty to use the affiliate account of the user this automation is running for. |
| Amount | Yes | The commission, as a number that is not negative. |
| Type | Yes | Sale, Opt-in, Lead or any type your site offers. |
| Status | Yes | Pending (the default), Unpaid, Paid or Rejected. |
| Description | No | A short note shown on the referral in AffiliateWP. |
| Reference | No | Usually the order or record the referral is for. |
| Context | No | Where it came from, such as woocommerce. Leave empty to file it under zapify. |
Insert tokens from your captured sample:
- Affiliate: the payload token that holds the affiliate's ID or email
- Amount: the payload token that holds the commission
- Type: Sale
- Status: Unpaid if the sale is already confirmed, or leave on Pending
- Reference: the payload token that holds the order number
- Context: a short label such as
crm
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
Send a test delivery from the outside service. Then open AffiliateWP → Referrals. Zapify → Logs shows Referral … was created for affiliate ….
Tokens you can use
| Token | What it holds |
|---|---|
| Received at / Raw body / Event type / External ID | Always available. |
| One token per payload field | Appear once you have captured a sample with Listen. |
The action makes two tokens available to later actions: Referral ID and Affiliate ID.
Conclusion
With the A webhook is received trigger and the Create a referral action, any sale can earn commission. To send data out as well, see sending a webhook when a referral is created.
FAQs
Is this free in Zapify?
The trigger is free, but the AffiliateWP action is part of the AffiliateWP PRO integration and needs an active Zapify PRO licence.
What if the affiliate cannot be found?
The run fails and says no affiliate was found for that value. Use an affiliate ID or the email of the affiliate's user.
Is the webhook safe to leave open?
The URL carries a long random key and you can also require a signature. See Webhooks.
What happens if the amount is not a number?
The run fails and says the amount is invalid, and no referral is created.
Do I need to write any code?
No. Everything is configured visually in the Zapify builder.