Rewarding streaks & loyalty
Copy-paste recipes for granting in-game rewards from a player's MMOLove daily streak, monthly streak, milestones, loyalty level and first vote.
Every counted vote already carries everything you need — see the payload
reference. These recipes assume you've verified the
signature (Signing) and made granting
idempotent on heart_id (Idempotency).
The signed webhook is the trusted channel — grant from it server-side. Never grant from a browser vote response.
Reward a daily-streak milestone
if (event.streak_milestone) grant(event.username, `streak-${event.streak_day}`); // day 7/14/…Tier by streak day
const byDay = { 3: "loyal-visitor", 7: "week-warrior", 14: "fortnight-faithful", 30: "monthly-legend" };
if (byDay[event.streak_day]) grant(event.username, byDay[event.streak_day]);Reward a monthly streak
Great for seasonal cycles — a player who votes in consecutive months keeps it alive:
if ((event.monthly_streak ?? 0) >= 3) grant(event.username, `loyal-${event.monthly_streak}-months`);Welcome a first-time voter
if (event.first_heart) grant(event.username, "welcome-pack");Gate by loyalty level
if ((event.loyalty_level ?? 0) >= 4) grant(event.username, "champion-cosmetic"); // Champion+Handle anonymous voters
Streaks and loyalty exist only for signed-in voters. Always grant the base reward, then add loyalty extras when present:
grant(event.username, "base-vote-reward");
if (!event.account_linked) return ok(); // anonymous: no streak/loyalty extras
if (event.streak_milestone) grant(event.username, `streak-${event.streak_day}`);See also
Payload reference
The exact heart.counted body and headers MMOLove delivers — every field, the heart.test shape, and idempotency via heart_id.
Signing & verification
The exact X-MMOLove-Signature HMAC scheme for reward callbacks — verify over the raw body, the header format, a worked example, and a replay-window recommendation.