Newer Version Available

This content describes an older version of this product. View Latest

Referral event

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

Resource

1referralEvent(emails:referralCode:eventType:version:devMode)

Signature

1public func referralEvent(emails: [String],
2                              referralCode: String,
3                              eventType: ReferralEventType = .refer,
4                              version: String = ReferralAPIVersion.defaultVersion,
5                              devMode: Bool = false) async throws -> ReferralEventOutputModel

Input Parameters

Parameter Type Description
devMode Boolean Indicates whether the method is run in the developer mode (true) or not (false).
emails String[] Required. A list of recipient emails to share the referral code with.
eventType String The type of event. Possible values are:
  • Enrollment
  • Purchase
  • Refer

The default value is Refer.

referralCode String Required. The referral code to share with the recipients.
version String The API version.

Return Value

ReferralEventOutputModel instance.

1public struct ReferralEventOutputModel: Codable

Sample Output

1{
2   "contactIds":[
3      "0031Q00002kCusB"
4   ],
5   "referralIds":[
6      "0wi1Q000000ljna"
7   ],
8   "referralStage":"Friend Completes First Purchase",
9   "transactionJournalIds":[
10      "0lV1Q0000019gJg",
11      "0lV1Q0000019gJh"
12   ],
13   "voucherId":"0kD1Q000000keXVUAY"
14}

Output Parameters

Referral Event Output