Overview
Follow these best practices to ensure your Sticker integration is secure, performant, and provides the best user experience.Authentication & Security
Protect Your API Key
Protect Your API Key
DO:
- Store API keys in environment variables
- Use secrets management systems (AWS Secrets Manager, HashiCorp Vault)
- Use different keys for sandbox and production
- Keep keys server-side only
- Hardcode API keys in source code
- Commit keys to version control
- Share keys in chat/email
- Expose keys in client-side code
Session Token Management
Session Token Management
DO:
- Generate tokens on-demand when user opens module
- Handle token expiration gracefully (tokens last 5 min)
- Regenerate tokens on authentication errors
- Clear any references when user logs out
- Pre-generate tokens in advance
- Cache or store session tokens
- Reuse tokens across sessions
- Share tokens between users
iframe Security
iframe Security
DO:
- Use sandbox attribute with proper permissions
- Implement Content Security Policy
- Use HTTPS for all environments
- Remove sandbox permissions unnecessarily
- Mix HTTP and HTTPS content
- Disable security features for convenience
Error Handling
Implement Retry Logic
Use exponential backoff for transient failures:Handle Rate Limiting
Respect rate limits and implement backoff:User-Friendly Error Messages
Transform technical errors into helpful messages:Performance Optimization
Don’t Cache Session Tokens
Session tokens are single-use and short-lived—never cache them:Preconnect to Sticker Domain
Speed up iframe loading:Monitor Performance
Track integration performance metrics:User Experience
Loading States
Always show loading indicators:Graceful Degradation
Provide fallback options when integration fails:Data Management
Use Your Internal IDs
Always use your internal identifiers for easy correlation:Handle Existing Users Gracefully
The setup endpoint returns 409 if user already exists—don’t treat this as an error:Testing
Integration Tests
Test your integration thoroughly:Use Sandbox Environment
Always test in sandbox first:Deployment Checklist
Before going live, verify:Security
- API keys stored securely in environment variables
- API key never exposed in client-side code
- iframe sandbox attributes configured
- HTTPS enabled on all pages
Error Handling
- Retry logic with exponential backoff
- Rate limiting handled gracefully
- User-friendly error messages
- Fallback UI for failures
User Experience
- Loading states for all async operations
- Responsive design on mobile devices
- Clear error messaging
- Easy retry/refresh options
Performance
- iframe loads in < 3 seconds
- API calls complete in < 2 seconds
- Metrics tracking implemented

