Skip to main content

Riot Callback Integration

advancedLast updated: 1/15/2024

Set up Riot webhooks for automatic game import when games finish

Riot Callback Integration

Set up Riot webhooks to automatically import games when they finish. This eliminates the need for manual game imports.

What are Riot Callbacks?

Riot callbacks (webhooks) allow Riot's servers to notify your platform when a game finishes:

  • Automatic Notification: Riot sends callback when game completes
  • Automatic Import: System imports game data automatically
  • No Manual Work: No need to manually import games
  • Real-Time Updates: Games imported as soon as they finish

How It Works

Callback Flow

  1. Game Finishes: Team finishes a game using tournament code
  2. Riot Sends Callback: Riot sends webhook to your server
  3. System Receives Callback: Your server receives the callback
  4. Game Identified: System finds game by tournament code
  5. Game Imported: Game data is fetched and imported automatically
  6. Match Updated: Match score and statistics updated

Benefits

  • Time Saving: No manual import needed
  • Accuracy: Games imported immediately
  • Reliability: Automatic process reduces errors
  • Real-Time: Updates happen as games finish

Prerequisites

Required Setup

Before setting up callbacks, you need:

  1. Riot API Access: Valid Riot API key
  2. Tournament Linked: Tournament linked to Riot tournament
  3. Tournament Codes: Codes generated for games
  4. Callback URL: Public URL for receiving callbacks
  5. Server Access: Ability to configure webhook endpoint

Riot Integration

Ensure you have:

  • Riot provider ID configured
  • Riot tournament ID set up
  • Tournament codes generating correctly
  • API access working

See Riot API Setup for details.

Setting Up Callbacks

Step 1: Configure Callback URL

Your callback endpoint is:

https://yourdomain.com/api/riot-callback

Requirements:

  • Must be publicly accessible
  • Must accept POST requests
  • Must return 200 OK response
  • Must be HTTPS (production)

Step 2: Register with Riot

Register your callback URL with Riot:

  1. Access Riot Developer Portal
  2. Navigate to Tournament Codes
  3. Configure Webhook URL
  4. Set Callback URL: Enter your callback endpoint
  5. Save Configuration

Step 3: Test Callback

Test that callbacks are working:

  1. Create Test Game: Use tournament code in test game
  2. Finish Game: Complete the game
  3. Check Logs: Verify callback received
  4. Verify Import: Check game was imported automatically

Callback Configuration

Callback Endpoint

The system provides a callback endpoint at:

/api/riot-callback

What It Does:

  • Receives callback data from Riot
  • Validates callback information
  • Finds matching game by tournament code
  • Imports game data automatically
  • Updates match scores
  • Returns success response

Callback Data

Riot sends callback with:

  • gameId: Riot game/match ID
  • shortCode: Tournament code used
  • region: Game region
  • startTime: Game start timestamp
  • gameMode: Game mode information
  • gameType: Type of game

Callback Processing

When callback is received:

  1. Validate Data: Check required fields present
  2. Find Game: Match tournament code to game
  3. Import Game: Fetch and import game data
  4. Update Match: Update match score and status
  5. Check Completion: Check if match completed
  6. Skip Unused: Auto-skip unused games if match done

Automatic Game Import

How Automatic Import Works

When callback is received:

  1. Game Identified: System finds game by tournament code
  2. Data Fetched: Game data fetched from Riot API
  3. Game Imported: Data imported into system
  4. Status Updated: Game marked as "Completed"
  5. Match Updated: Match score updated
  6. Completion Checked: System checks if match completed

Match Completion

After game import:

  • Match score is updated
  • System checks if match is complete
  • If complete, remaining games are skipped
  • Match status updated to "Completed"

Troubleshooting Callbacks

Callbacks Not Received

Problem: Callbacks not arriving

Solutions:

  • Verify callback URL is correct
  • Check URL is publicly accessible
  • Ensure HTTPS is used (production)
  • Verify Riot configuration
  • Check server logs for errors
  • Test callback endpoint manually

Callbacks Received But Not Processing

Problem: Callbacks arrive but games not importing

Solutions:

  • Check server logs for errors
  • Verify callback data format
  • Check tournament code matching
  • Verify Riot API access
  • Check game identification logic
  • Review import process

Games Not Found

Problem: Callback can't find matching game

Solutions:

  • Verify tournament code matches
  • Check game exists in system
  • Ensure codes were generated correctly
  • Verify code format is correct
  • Check game state (should be Pending)

Import Failures

Problem: Callback received but import fails

Solutions:

  • Check Riot API access
  • Verify game ID is valid
  • Check region matches
  • Review error logs
  • Verify API rate limits
  • Check data format

Best Practices

Callback Setup

  • Use HTTPS: Always use HTTPS in production
  • Test Thoroughly: Test callbacks before tournament
  • Monitor Logs: Watch for callback errors
  • Have Backup: Keep manual import as backup
  • Document Setup: Keep notes on configuration

Monitoring

  • Watch Logs: Monitor callback logs regularly
  • Check Imports: Verify games importing correctly
  • Track Errors: Note any callback failures
  • Review Performance: Monitor callback processing time
  • Alert on Issues: Set up alerts for failures

Reliability

  • Redundancy: Have backup import method
  • Error Handling: Handle callback errors gracefully
  • Retry Logic: Riot will retry failed callbacks
  • Validation: Validate all callback data
  • Logging: Log all callback activity

Manual Import as Backup

Even with callbacks set up:

  • Keep Manual Option: Manual import still available
  • Use When Needed: Use if callbacks fail
  • Verify Results: Check imported games
  • Monitor Both: Watch both automatic and manual imports

Callback Response

Success Response

When callback is processed successfully:

  • Returns 200 OK status
  • Riot knows callback was received
  • Riot won't retry the callback

Error Response

If callback fails:

  • Returns error status (400, 500, etc.)
  • Riot will retry the callback
  • System logs the error
  • Manual import may be needed

Security Considerations

Callback Security

  • Validate Source: Verify callbacks from Riot
  • HTTPS Only: Use HTTPS for callbacks
  • Rate Limiting: Implement rate limiting
  • Error Handling: Don't expose sensitive info in errors
  • Logging: Log security-relevant events
Tags:game-managementriotcallbackswebhooksautomation

Was this article helpful?