Riot Callback Integration
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
- Game Finishes: Team finishes a game using tournament code
- Riot Sends Callback: Riot sends webhook to your server
- System Receives Callback: Your server receives the callback
- Game Identified: System finds game by tournament code
- Game Imported: Game data is fetched and imported automatically
- 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:
- Riot API Access: Valid Riot API key
- Tournament Linked: Tournament linked to Riot tournament
- Tournament Codes: Codes generated for games
- Callback URL: Public URL for receiving callbacks
- 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:
- Access Riot Developer Portal
- Navigate to Tournament Codes
- Configure Webhook URL
- Set Callback URL: Enter your callback endpoint
- Save Configuration
Step 3: Test Callback
Test that callbacks are working:
- Create Test Game: Use tournament code in test game
- Finish Game: Complete the game
- Check Logs: Verify callback received
- 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:
- Validate Data: Check required fields present
- Find Game: Match tournament code to game
- Import Game: Fetch and import game data
- Update Match: Update match score and status
- Check Completion: Check if match completed
- Skip Unused: Auto-skip unused games if match done
Automatic Game Import
How Automatic Import Works
When callback is received:
- Game Identified: System finds game by tournament code
- Data Fetched: Game data fetched from Riot API
- Game Imported: Data imported into system
- Status Updated: Game marked as "Completed"
- Match Updated: Match score updated
- 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 OKstatus - 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