How to Register New Advocates

There are two different ways to register new advocates on Genius Referrals Platform when using AIM

  1. Using the one of our SDKs
  2. Using our RESTful API. Check out the details here.

Using one of our SDKs is very easy and you can do it by calling the method postAdvocate(...) to register the new advocate and by calling the method patchAdvocate(...) to set the proper currency to the advocate.  Bellow we show you an example. 

Remember that every customer in your application represents an advocate in Genius Referrals platform. So you have to register all your customers in Genius Referrals platform.

When registering new advocates you need to send the following parameters per each advocate:

  • Account Slug: The identifier for the account
  • Name: The name of the advocate
  • Last name: The lastname of the advocate
  • Email: The email of the advocate
  • Payout Threshold: This represents the amount bonuses the advocate has to generate before redeeming his bonuses. 

There are mainly two ways to get the Account Slug parameter. You can get it from your account page on our Control Center or by using the SDK method getAccounts

Avoiding sending personal data to genius referrals platform

If for security reasons you don't want to send your customers personal information to our platform, you can send references to the name, last name and email instead. Keep in mind that you must store this references locally on your application. 

As an example, we are going to create the following advocate for the account 'My store' that we created previously. 

  • Account Slug: my-store
  • Name: John
  • Last name: Smith
  • Email:
  • Payout Threshold: 5 

Example using the PHP SDK: 

Using the Javascript SDK

We have several examples of how implement this integration with Javascript here. So check it out if Javascript is your way to go. 

Updating advocate's currency

After registering and advocate you need to update the advocate's currency, otherwise the advocate will not be able to receive bonuses. 

     * On your action method just do something like this
    // Create a new GRPHPAPIClient object 
    $objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');

    //preparing the data to be sent on the request
    $arrAdvocate = array(
        'advocate' => array(
            "name" => "Jonh", 
            "lastname" => "Smith", 
            "email" => "", 
            "payout_threshold" => 5
    $objResponse = $objGeniusReferralsAPIClient->postAdvocate('my-store', $arrAdvocate);
    $intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
    // advocate successfully created
    if($intResponseCode == 201){
        //getting the advocate token from the Location header
        $arrLocation = $objResponse->getHeader('Location')->raw(); 
        $strLocation = $arrLocation[0];
        $arrParts = explode('/', $strLocation); 
        $strAdvocateToken = end($arrParts); 
        //Updating the advocate currency
        $arrParams = array('currency_code' =>  'USD'); 
        $objResponse = $objGeniusReferralsAPIClient->patchAdvocate('my-store', $strAdvocateToken, $arrParams); 
        $intResponseCode1 = $objGeniusReferralsAPIClient->getResponseCode();
        if($intResponseCode1 == 204){
            //currency successfully updated
            // TODO: Save the reference between the new advocate and the customer on your local database.
            // Use the $strAdvocateToken as a reference so that you can later use the method getAdvocate(...)
            // to retrive the advocate data.
            // handle errors
        // handle errors
Remember to replace the YOUR_USERNAME and YOUR_API_TOKEN by the ones generated for you

For more information about the Advocate, object review our RESTful API and our SDKs

Resource Extension Size

Please leave your comments/questions below