Loyalty API

Write Call

Refer2

Sends a referral using the same flow as the loyalty referral block.

Kind Write API call
Method POST
URL https://app.bubblehouse.com/api/v2023061/<shop>/Refer2
Authentication Customer TokenShop Token
You have a choice of making this call from your server using a shop token and specifying a customer ID, or making this call from a web browser/app using a customer token you have generated on the server.

This call applies the same validations, conditions, eligibility checks, reuse rules, and side effects as the loyalty referral block.

The response returns the created referral row together with the follow-up share action so a website or app can continue the referral flow without reproducing channel-specific URL logic.

Input

  • customer CustomerIdentity1 required if using a shop token

    A customer to operate upon, when using a shop token.

    If you're using a customer token and decide to pass this field (which we do not recommend), it must match the customer from the token.

  • sender string optional

    Sender email preserved for compatibility with Refer1. If the customer is already identified by the token or customer object, that identity takes precedence.

  • channel ReferralChannel1 required

    The method used to deliver the referral link (or code) to the target person or audience.

  • destination string optional

    An email address for the email channel, omit or pass null otherwise.

Output

  • message string optional

    User-facing success message when the referral flow produces one. The messages are highly customizable and entirely depend on the shop configuration.

  • referral Referral2 required

    The referral row that has just been created or reused.

  • share_action ReferralShareAction1 optional

    Instructions for what the caller should do next to complete sharing the referral, if anything.

API-wide Errors

Status Error Reason & Examples
400 missing_customer_identity

The customer identity ('customer' input parameter) has not been specified when using a shop token. You need to either specify a non-empty value for one of the customer identity fields, or use a customer token.

404 empty_customer_identity

All fields of the customer identity ('customer' input parameter) have been empty when using a shop token. You need to either specify a non-empty value for one of the customer identity fields, or use a customer token.

404 customer_identity_partially_mismatches_matched_customer

A customer has been matched by one of the fields of the customer identity ('customer' input parameter), but some non-empty fields do not match Bubblehouse data on that customer.

404 no_customers_match_customer_identity

The customer identity ('customer' input parameter) does not match a known customer.

403 customer_identity_does_not_match_token

API call is using a customer token, but the customer identity in API params does not match the customer from the token.

Global Errors

Status Error Reason & Examples
400 obsolete_global_api_version

The global API version you are trying to use is no longer supported.

400 inaccessible_global_api_version

The global API version you are trying to use is not enabled on your account.

400 invalid_global_api_version

The global API version you are trying to use has never existed.

401 invalid_token

The provided authentication token is invalid or has expired.

429 rate_limit_exceeded

Your usage is over the rate limit. Ensure that you're not making duplicate calls, and contact our team for a rate limit increase.

Previous
RedeemPoints1