Prerequisites
- An active Masivo account with a SERVER API key
- A customer registered in Masivo with an
external_idmatching your system’s customer identifier - At least one reward configured in your account
Create the campaign
Open the Score Streaks section
In the dashboard navigate to Campaigns → Score Streaks and click New campaign.
Set the trigger event
Choose the event type your customers will send (e.g.
PURCHASE, CHECK_IN). Every time a customer sends this event it counts toward their streak.Configure the loss condition
Set how long a customer has to send the next qualifying event before the streak is broken. For example, 1 DAY means the customer must check in daily to keep their streak alive.
Add milestone rewards
Click Add milestone to define score thresholds. Each milestone triggers a reward when the customer’s score reaches that number in the current cycle.Example milestone tiers:
- Score 1 → 10 points (daily reward)
- Score 7 → 100 points (weekly bonus)
- Score 30 → 500 points (monthly champion)
Optional: enable scheduled resets
Toggle Scheduled reset if you want streaks to restart on a fixed calendar date regardless of the customer’s activity — useful for monthly leaderboards or seasonal campaigns.
Send qualifying events
Use the Emit event endpoint from your backend:- Identify matching score streak campaigns for this event type
- Find or create the customer’s
score_streakrecord - Check if the loss window expired (and close the cycle if so)
- Increment the score and write a
GAINhistory event - Fire any milestone rewards and write
MILESTONEhistory events - Return the API response — rewards accumulate in the customer’s wallet
Display streak progress
Fetch the customer’s active streaks to show a live progress indicator:| Field | Use |
|---|---|
current_score | Current streak score in this cycle |
period_ends_at | Deadline for next qualifying event (show a countdown) |
current_streak | Total qualifying events in current cycle |
last_loss_at | Last time the streak was broken |
Show streak history
Passinclude=history to get a flattened, time-ordered list of all history events across all streaks for this customer:
include=history:
history to render an activity feed, a streak timeline, or to debug unexpected state.
Common patterns
Show a countdown timer
Detect a broken streak
Find the next milestone
Given the campaign rules sorted bymilestone ascending:
Frequently asked questions
What happens when an event is reversed?
What happens when an event is reversed?
The associated
GAIN and MILESTONE history events are marked as reversed and an EVENT_REVERSAL history event is appended. If the reversed event was in the active cycle, the score and streak count are rolled back. The operation is idempotent.What happens at the loss window deadline if no event arrives?
What happens at the loss window deadline if no event arrives?
The cron job (
/api/cron/loyalty/score_streaks) runs periodically. When it finds a streak whose period_ends_at is in the past, it closes the active cycle with a LOSS history event. The next qualifying event from the customer starts a fresh cycle.Can a customer earn the same milestone reward multiple times?
Can a customer earn the same milestone reward multiple times?
Yes — once per cycle. If the streak is lost (new cycle) and the customer reaches the same milestone again, the reward is granted again. Within a single cycle, each milestone fires exactly once.
What does scheduled reset do vs. loss condition?
What does scheduled reset do vs. loss condition?
The loss condition is triggered by inactivity: the customer fails to act before the period expires. A scheduled reset fires on a fixed calendar schedule regardless of activity — even a customer with a perfect streak is reset on the configured date.
How do I reset a streak manually for a customer?
How do I reset a streak manually for a customer?
Use the internal admin endpoint
POST /api/admin/score-streaks/reset with the account_id, campaign_id, customer_id, and a reason. This requires the CRON_CHECKSUM header and is intended for support operations.