Create Referral Event

Create referral event records when an advocate refers a friend, or when referred friends sign up or make a purchase.

This action is available in API version 60.0 and later for users with the Referral Marketing license.

Supported REST HTTP Methods 

URI: /services/data/vXX.X/actions/standard/processReferralEvent

Formats: JSON

HTTP Methods: POST

Authentication: Authorization: Bearer TOKEN

Inputs 

activityDateTime 

Type: DateTime

Description: Required. The date and time when the referral event took place.

eventType 

Type: String

Description: Required. The type of event that the referral completed. Possible values are:

  • Refer
  • Enrollment
  • Purchase

externalReferenceNumber 

Type: String

Description: The number generated by an external system for the referral event.

referralCode 

Type: String

Description: Required. The referral code used by a referral to sign up as a customer, or to make a purchase. The referral code is a combination of the advocate’s referral code and the promotion code separated by a hyphen.

referralContactId 

Type: String

Description: The contact ID of the referral who signed up to be a customer, or to make a purchase.

referralEmail 

Type: String

Description: The email address of the referral who has signed up to be a customer, or to make a purchase.

referralFirstName 

Type: String

Description: The first name of the referral who signed up to be a customer, or to make a purchase.

referralLastName 

Type: String

Description: The last name of the referral who signed up to be a customer, or to make a purchase.

productId 

Type: String

Description: The ID of the product that the referral purchased.

purchaseAmount 

Type: String

Description: The amount the referral spent to purchase one or more units of a product.

purchaseQuantity 

Type: String

Description: The number of units that the referral purchased of a product.

Outputs 

contactId 

Type: String

Description: The ID of the contact record that’s either created for the referral or that uniquely identifies the referral.

referralId 

Type: String

Description: The ID of the referral record of the person who was referred, or whose referral event is processed.

referralStage 

Type: String

Description: The current stage of the referral promotion for a referral. Possible values are:

  • Promotion Launched
  • Advocate Joins Promotion
  • Advocate Refers Friend
  • Friend Signs Up
  • Friend Completes First Purchase

transactionJournalIds 

Type: String

Description: The comma separate list of transaction journal IDs created to process the referral event.

voucherId 

Type: String

Description: The ID of the voucher issued to either the referral signing up or to the advocate after the referral completes a purchase.

Example 

Sample Request 

1{
2   "inputs":[
3      {
4         "referralCode":"referralCode-promotionCode",
5         "referralContactId":"003xx000004WkhEAAS",
6         "referralFirstName":"Michael",
7         "referralLastName":"Clare",
8         "referralEmail":"mclare@salesforce.com",
9         "activityDateTime":"2021-04-13T00:00:00",
10         "eventType":"Purchase",
11         "productId":"01txx0000006iGyAAI",
12         "purchaseAmount":40000,
13         "purchaseQuantity":34,
14         "externalReferenceNumber":"003xx00000000fxEAA"
15      }
16   ]
17}

Sample Response 

1[
2   {
3      "actionName":"processReferralEvent",
4      "errors":null,
5      "isSuccess":true,
6      "outputValues":{
7         "contactId":"003RM000008O9ZT",
8         "transactionJournalIds":[
9            "0lVRM0000002qtT",
10            "0lVRM0000002qtU"
11         ],
12         "referralId":"0wiRM0000004CPf",
13         "referralStage":"Friend Completes First Purchase",
14         "voucherId":"0kDRM0000004DZl2AM"
15      },
16      "version":1
17   }
18]