AffiliateWP Automations
How to Post a Slack Message When an Affiliate Earns a Referral in AffiliateWP
Referrals are sales your team did not have to chase, and they are worth celebrating. To post a Slack message when an affiliate earns a referral in AffiliateWP, use Zapify's An affiliate earns a referral trigger with the Send a Slack message action. AffiliateWP and Slack are Zapify PRO integrations.
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 Slack message (
SLACK_SEND_MESSAGE, Slack)
Each time a referral is created, Zapify posts a message to your Slack channel with the affiliate, the amount and what was sold.
PRO feature
AffiliateWP and Slack are Zapify PRO integrations, 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.
- A Slack app for your workspace with a bot user OAuth token (starts
xoxb-) and thechat:writescope, and the bot invited into the channel you want it to post to. See Slack's authentication basics if you are setting one up for the first time.
How to build the automation
Step 1: Connect Slack
- Go to Settings → Connections and click Add New.

- Choose Slack, paste in the bot user OAuth token, and name the connection something like Team Slack.

- Save.
See Connections for how this screen works generally.
Step 2: Create a new automation
- In the WordPress admin, go to Zapify → Automations.
- Click Add New to open the builder.
- Name it clearly, such as Celebrate referrals in Slack.

Step 3: 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 as they are for every referral, or choose a Referral type or Product ID to only announce certain ones. Keep Run for on The affiliate.
Step 4: Add the "Send a Slack message" action
- Click Add Action.

- Choose Slack as the app.

- Select Send a Slack message.

Step 5: Configure the action
| Field | Required | What it does |
|---|---|---|
| Connection | Yes | The Slack connection from Step 1. |
| Channel | Yes | A channel name such as #affiliates, or its ID. The bot must already be a member. |
| Message | Yes | The text to post. Insert tokens with the {} button. |
| Post as | No | Overrides the bot's display name for this message. Leave empty to use the bot's own name. |
For example:
- Channel:
#affiliates - Message:
New referral for {Display name}: {Referral amount} on {Referral products} ({Referral context}). Their total earnings are {Affiliate earnings}.
Step 6: 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 7: Test it
Make a test purchase through a test affiliate's link. The message should appear within a minute. Otherwise open Zapify → Logs.
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 Slack message action, your team sees the program working. For a permanent record, log each referral to a Google Sheet.
FAQs
Is this free in Zapify?
No. AffiliateWP and Slack are both Zapify PRO integrations and need an active Zapify PRO licence. Slack also needs a Connection.
The message arrives before the order is complete. Why?
Referrals for store orders are usually created as Pending at checkout. Use the status trigger set to Unpaid if you only want confirmed commissions.
Can I post big wins only?
Use Product ID to limit it to your highest-value product.
Do I need to write any code?
No. Everything is configured visually in the Zapify builder.