Segment Updates

Integration Overview

This integration uses Braze Webhooks to send data to Open Loyalty. When a user enters a specific segment in Braze, we trigger a webhook that sends a PATCH request to the Open Loyalty Member API. This updates the member's Labels (custom attributes), which can then be used to define segments within Open Loyalty.

Prerequisites

Prerequisite
Description

Open Loyalty API Token

A permanent token (X-AUTH-TOKEN) with permission to modify members.

Tenant ID

Your Open Loyalty Tenant ID (e.g., KHO).

Matching IDs

The user's external_id in Braze must match their loyaltyCardNumber in Open Loyalty.


Setting up the integration

1

Prepare Open Loyalty

Before sending data, ensure Open Loyalty is ready to utilize the incoming label.

  1. Decide on the Label Key you will use (e.g., braze_vip_segment or braze_optedIn).

  2. In Open Loyalty, create a Segment that filters members based on this label. * Condition: Member has custom attribute value braze_vip_segment equal to optedIn.

2

Create Braze Webhook Campaign

We will configure Braze to send the API request whenever a user qualifies for the segment.

  1. In Braze, create a new Webhook Campaign (or use a Webhook within a Canvas).

  2. Click on Compose Webhook

  3. Webhook URL: Construct the URL using your Open Loyalty instance, Tenant ID, and the Braze Liquid variable for the user ID.

    1. Format: https://<YOUR_OL_INSTANCE>/api/<TENANT_ID>/member/loyaltyCardNumber={{${user_id}}}

    2. Request Method: PATCH

    3. Request Headers:

      • Content-Type: application/json

      • X-AUTH-TOKEN: <YOUR_PERMANENT_TOKEN>

      • User-Agent: Braze

    4. Request Body: Select Raw text and paste the payload. You can customize the key and value to match your segment strategy.

{
  "customer": {
    "labels": [
      {
        "key": "braze_vip_segment",
        "value": "optedIn"
      }
    ]
  }
}
3

Configure the Trigger

  1. Navigate to the Delivery or Entry Schedule tab.

  2. Delivery Method: Action-Based.

  3. Trigger: Define Relevant Trigger

  4. Launch: Activate the campaign.

4

Testing the Setup

  1. Trigger the Sync:

    • Identify a test user in Braze who is not currently in the target segment (e.g., "VIP Users").

    • Manually perform the action that qualifies them for the segment.

      • Example: If the segment logic is "Custom Attribute spend_amount > 500", go to the user's profile in Braze and manually edit their spend_amount to 501.

    • This forces the user to enter the segment, triggering the webhook campaign.

  2. Verify in Braze:

    • Go to Settings > Message Activity Log.

    • Look for the recent webhook event for your campaign.

    • Confirm the status is 200 OK. If it failed, check the log for error messages (e.g., 401 Unauthorized often means an invalid API token).

  3. Verify in Open Loyalty:

    • Log in to the Open Loyalty Admin Panel.

    • Navigate to Members > All Members and search for the test user by their loyaltyCardNumber.

    • Open their profile and check the Labels (or Custom Attributes) section.

    • Success: You should see the new label (e.g., braze_brazeSegmentId: "optedIn").

    • Optional: If you created a Segment in Open Loyalty based on this label, confirm the user now appears in that segment.

Last updated

Was this helpful?