👀 Cheat Sheet

Lynes Loyalty Cheatsheet

Quick Reference

FunctionAPI EndpointMethodKey Parameters
Track Event/v1/eventPOSTeventId, customerId, amount
Get User Points/v1/customer/{id}/pointsGETid (path parameter)
Check Challenge Progress/v1/customer/{id}/challengesGETid (path parameter)
View User Streaks/v1/customer/{id}/streaksGETid (path parameter)

System Overview

Lynes Loyalty is an event-driven gamification platform that converts user actions into rewards and engagement features:

System Flow:

User Actions → Events → Lynes API → Multiple Outputs:
- Points/Rewards
- Challenges
- Streaks
- Leaderboards
- Analytics

Events Reference

Key Event Settings

  • Maximum Completions: How many times a user can earn rewards (daily/weekly/unlimited)
  • Reward: Points to award (fixed or per unit)
  • Condition: For conditional events, the threshold that triggers the reward
  • User Group Specific: Different rewards for different user segments

API Endpoint

POST https://api.lynesapp.de/v1/event

Basic Event Structure

{
  "eventId": "string",     // ID from dashboard
  "customerId": "string",  // User identifier
  "amount": number,        // Optional for fixed, required for others
  "metadata": {            // Optional additional data
    "key": "value"
  },
  "timestamp": "2023-05-01T14:30:00Z"  // Optional, ISO 8601 format
}

Challenge Reference

Challenge Types

TypeDescriptionExample
SeriesProgressive challenges in sequenceComplete 5, 10, then 25 trips
SingleStandalone objectivesComplete your profile
Time-LimitedLimited-duration challengesOrder 3× during holiday season

Challenge Configuration

  • Based on events already in your system
  • Require specific actions a certain number of times
  • Can be automatically sequenced (Series)
  • Can have start/end dates (Time-Limited)

Retrieving Challenge Progress

GET https://api.lynesapp.de/v1/customer/{id}/challenges

Streak Reference

Streak Types

PeriodDescriptionUse Case
DailyAction performed each dayApp opens, daily check-ins
WeeklyAction at least once per weekWeekly purchases
MonthlyAction at least once per monthMonthly subscription renewal

Streak Features

  • Event-Based: Uses existing events
  • Zero-Code: Configured in dashboard
  • Automatic Tracking: System maintains streak counts

Checking User Streaks

GET https://api.lynesapp.de/v1/customer/{id}/streaks

Implementation Checklist

  1. Identify Key Events

    • User registration/login
    • Content consumption
    • Purchases/transactions
    • Social interactions
    • Feature usage
  2. Set Up Events in Dashboard

    • Create event with appropriate type
    • Configure reward settings
    • Set completion limits
    • Add user group specifics (if needed)
  3. Implement in Your Application

    // Example API call
    fetch("https://api.lynesapp.de/v1/event", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer YOUR_JWT",
      },
      body: JSON.stringify({
        eventId: "purchase",
        customerId: "user123",
        amount: 49.99,
      }),
    });
  4. Configure Gamification Features

    • Create challenges based on events
    • Set up streaks for consistency
    • Design leaderboards for competition

Error Handling

HTTP StatusCommon CauseRecommended Action
400Invalid event structureCheck required parameters and format
401Authentication failureVerify your API key or token
404Event or customer not foundConfirm IDs are correct
429Rate limit exceededImplement exponential backoff
500Server errorRetry with backoff, then contact support

Best Practices

  • Event Design

    • Start with core actions users already perform
    • Use meaningful, consistent naming
    • Consider both reward-based and tracking-only events
  • API Usage

    • Handle errors gracefully
    • Batch events when possible
    • Include detailed metadata
    • Use unique user identifiers consistently
    • Set correct timestamps for offline events
  • Reward Economy

    • Balance point values across actions
    • Control point inflation with max completions
    • Use non-rewarding events for analytics
    • Consider user groups for segment-specific rewards

Common Event-Tracking Examples

User ActionEvent TypeConfiguration
LoginFix5-10 points, once daily
PurchaseTransactional1-2 points per $1 spent
Watch VideoConditional20 points when 5+ minutes watched
Complete ProfileFix50 points, once ever
ReferralFix100 points per referral

System Automation Flow

  1. User performs action in your application
  2. Your app sends event to Lynes API
  3. System validates the event
  4. Points are awarded (if applicable)
  5. Challenges progress is updated
  6. Streaks are calculated/maintained
  7. Leaderboards are refreshed
  8. Analytics data is recorded

SDK Integration

// Initialize the SDK
import { LynesLoyalty } from "lynes-loyalty-sdk";
 
const loyalty = new LynesLoyalty({
  apiKey: "YOUR_API_KEY",
  environment: "production", // or 'development'
});
 
// Track an event
loyalty.trackEvent({
  eventId: "article_read",
  customerId: "user123",
  amount: 1,
});
 
// Get user points
const points = await loyalty.getPoints("user123");

Glossary

TermDefinition
EventA tracked user action that can trigger rewards
ChallengeA goal for users to achieve by completing specific events
StreakConsistent performance of actions over time
User GroupSegment of users with specific reward rules
LeaderboardCompetitive ranking of users based on points or actions