ReferralAPIManager

The ReferralAPIManager class invokes and manages referral-related REST API requests. Use this class to interact with the Salesforce Referral Marketing APIs and manage referral-related operations.

Methods 

referralEnrollment 

Enroll an existing member to a given promotion using the membership number.

1public func referralEnrollment(membershipNumber: String,
2                                   promotionCode: String,
3                                   memberStatus: String = MemberStatus.active.rawValue,
4                                   version: String = ReferralAPIVersion.defaultVersion,
5                                   devMode: Bool = false) async throws -> ReferralEnrollmentOutputModel

Enroll an existing member to a given promotion using the contact ID.

1public func referralEnrollment(contactID: String,
2                                   promotionCode: String,
3                                   memberStatus: String = MemberStatus.active.rawValue,
4                                   version: String = ReferralAPIVersion.defaultVersion,
5                                   devMode: Bool = false) async throws -> ReferralEnrollmentOutputModel

Enroll a new member to a given promotion.

1public func referralEnrollment(firstName: String,
2                                   lastName: String,
3                                   email: String,
4                                   membershipNumber: String,
5                                   promotionCode: String,
6                                   enrollmentChannel: ReferralEnrollmentChannel = ReferralEnrollmentChannel.mobile,
7                                   memberStatus: String = MemberStatus.active.rawValue,
8                                   tjStatementFrequency: TransactionJournalStatementFrequency = .monthly,
9                                   tjStatementMethod: TransactionJournalStatementMethod = .email,
10                                   version: String = ReferralAPIVersion.defaultVersion,
11                                   devMode: Bool = false) async throws -> ReferralEnrollmentOutputModel
ParameterTypeDescription
contactIDStringRequired. The contact ID of the existing member. Provide either the contact ID, the membership number, or the person account details (first name, last name, and email), and not all.
countryStringThe name of the country of the member.
devModeBooleanIndicates whether the method is run in the developer mode (true) or not (false).
emailStringRequired. The email ID of the member.
enrollmentChannelStringChannel used to join the referral program. Possible values are CallCenter, Email, Franchise, Mobile, Partner, Pos, Print, Social, Store, or Web. The default value is Email.
firstNameStringRequired. The first name of the member. Provide either the contact ID, the membership number, or the person account details (first name, last name, and email), and not all.
lastNameStringRequired. The last name of the member. Provide either the contact ID, the membership number, or the person account details (first name, last name, and email), and not all.
memberStatusStringStatus of the new advocate after enrollment. Possible values are Active, Inactive, or a custom value defined in your org. For example, if an advocate must be evaluated before confirming enrollment, you can create a status called On Hold and assign it to this field. The default value is Active.
membershipNumberStringRequired. The membership number of the existing member. Provide either the contact ID, the membership number, or the person account details (first name, last name, and email), and not all.
promotionCodeStringRequired. The promotion code to enroll for.
stateStringThe name of the state of the member.
transactionalJournalFrequencyStringThe frequency at which transaction statements must be generated for the advocate. Possible values are Monthly or Quarterly. The default value is Monthly.
transactionalJournalMethodStringPreferred method of receiving transaction journal statements. Possible values are Email or Mail. The default value is Email.
versionStringThe API version.

referralEvent 

Send referral emails to the given recipients.

1public func referralEvent(emails: [String],
2                              referralCode: String,
3                              eventType: ReferralEventType = .refer,
4                              version: String = ReferralAPIVersion.defaultVersion,
5                              devMode: Bool = false) async throws -> ReferralEventOutputModel
ParameterTypeDescription
devModeBooleanIndicates whether the method is run in the developer mode (true) or not (false).
emailsString[]Required. A list of recipient emails to share the referral code with.
eventTypeStringThe type of event. Possible values are Enrollment, Purchase, or Refer. The default value is Refer.
referralCodeStringRequired. The referral code to share with the recipients.
versionStringThe API version.