I’d like to develop a way where I could notify users of a twitch stream when an affiliate purchase happens. Is there a way to do this? Is there an api endpoint that could be monitored or hook that could be fired to throw an alert within streamlabs that would allow this to happen.
I’m mainly looking for a way to throw an alert when an affiliate purchase happens.
Frankly I’m not even sure how to go about starting this but looking for ideas on how to get this to happen.
@squiggie, We do have an action hook that can be triggered to reward a commission to an affiliate: https://wpaffiliatemanager.com/api-track-commission-via-a-wordpress-hook/
I’m struggling to see how this all might tie together. Can you help me visualize the process or walk through the process?
A custom wordpress plugin/app allows affiliates to OAuth to the StreamLabs API and stores their access token and twitch username in the WordPress DB
A Custom Field on the affiliate registration page would allow an affiliate to enter their Twitch Username thus allowing us to associate that twitch username with the access token granted above. I’m assuming these custom fields are stored in the wordpress database right?
A user comes to the site based on an affiliate link
They purchase a product
The do_action(‘wpam_process_affiliate_commission’, $args); is triggered
I get the affiliate id by getting it from the cookie $aff_id = $_COOKIE[‘wpam_id’];
With the affiliate_id, I query the custom fields to get the access to twitch username above
With the twitch username, I query the db to get the Streamlabs access token
With the token, I send a request to the StreamLabs api with the Alert Box Information
Does this make sense? Are my assumptions about the Custom Affiliate Fields correct and are they stored in the DB?
You must be logged in to reply to this topic.