Loyalty-related Events

This section describes the event types related to the Sparkfly Loyalty platform.

loyalty.enrollment.created

This event is fired when a new loyalty enrollment is created. The event payload contains information about the member and their enrollment details.

Example payload:

{
    "event_name": "loyalty.enrollment.created",
    /* ... standard event metadata fields ... */
    "data": {
        "enrollment": {
            "id": 1,
            "source": "app",
            "created_at": "2023-11-15T16:55:27Z",
            "external_id": "2",
            "program_id": 1,
            "member": {
                "id": 1,
                "identifier": "1"
            }
        }
    }
}

loyalty.enrollment.points.awarded

This event is fired when points are awarded to a member's loyalty enrollment. The event payload contains information about the member, their enrollment details, and the points awarded.

This can occur in various scenarios, such as when a member earns points through purchases or via manual adjustments by administrators.

Example payload:

{
    "event_name": "loyalty.enrollment.points.awarded",
    /* ... standard event metadata fields ... */
    "data": {
        "member": {
            "id": 1,
            "identifier": "1",
            "enrollment": {
                "id": 1,
                "external_id": "1",
                "current_points": 100,
                "points_earned": 150,
                "historical_points": 1000
            }
        }
    }
}

loyalty.enrollment.points.redeemed

This event is fired when points are redeemed from a member's loyalty enrollment. The event payload contains information about the member, their enrollment details, the points redeemed, and the reward state associated with the redemption.

Example payload:

{
    "event_name": "loyalty.enrollment.points.redeemed",
    /* ... standard event metadata fields ... */
    "data": {
        "points_redeemed": 100,
        "member": {
            "created_at": "2024-11-03T04:19:15Z",
            "enrollment": {
                "created_at": "2025-09-04T16:18:54Z",
                "current_point_balance": 7260,
                "external_id": "SFTestEnrollment",
                "id": 5678,
                "program_id": "102",
                "source": "source_system",
            },
            "id": 12345,
            "identifier": "member-identifier-123"
        },
        "reward_state": {
            "created_at": "2025-11-11T21:36:48Z",
            "credential_identifier": "Z6TEFA4",
            "id": 1234, 
            "issued_point_value": 100,
            "offer_state_id": 3456
        }
    }
}

sf.loyalty.enrollment.points_expired

This event is fired when the Sparkfly Loyalty platform detects that a loyalty enrollment had points expire. The event payload contains information about the member, their enrollment details, and the amount of points expired. These events will typically be sent within 24 hours of points having expired. Note that the exact timestamp of the expiration is not included in the payload.

Example payload:

{
    "event_name": "sf.loyalty.enrollment.points_expired",
    /* ... standard event metadata fields ... */
    "data": {
        "points_expired": 150,
        "member": {
            "id": 12345,
            "identifier": "member-identifier-123"
        },
        "enrollment": {
            "id": 5678,
            "external_id": "SFTestEnrollment",
            "current_point_balance": 1000
        }
    }
}

sf.loyalty.enrollment.tier_increased

This event is fired when the loyalty enrollment tier is increased. The event payload contains information about the member, their enrollment details, the previous tier, and the new tier.

Example payload:

{
    "event_name": "sf.loyalty.enrollment.tier_increased",
    /* ... standard event metadata fields ... */
    "data": {
        "member": {
            "id": 12345,
            "identifier": "member-identifier-123"
        },
        "enrollment": {
            "id": 5678,
            "external_id": "SFTestEnrollment",
        },
        "previous_tier": {
            "id": 12345,
            "name": "tier name"
        },
        "new_tier": {
            "id": 12345,
            "name": "tier name",
            "expiration_date": "2026-03-26" 
        }
    }
}

sf.loyalty.enrollment.tier_decreased

This event is fired when the loyalty enrollment tier is decreased. The event payload contains information about the member, their enrollment details, the previous tier, and the new tier.

Example payload:

{
    "event_name": "sf.loyalty.enrollment.tier_decreased",
    /* ... standard event metadata fields ... */
    "data": {
        "member": {
            "id": 12345,
            "identifier": "member-identifier-123"
        },
        "enrollment": {
            "id": 5678,
            "external_id": "SFTestEnrollment",
        },
        "previous_tier": {
            "id": 12345,
            "name": "tier name"
        },
        "new_tier": {
            "id": 12345,
            "name": "tier name",
            "expiration_date": "2026-03-26" 
        }
    }
}