Save user preferences locally for returning users:
Copy
// Save preferences after user sets themlocalStorage.setItem('guestPreferences', JSON.stringify(preferences));// Restore on app launchconst savedPrefs = localStorage.getItem('guestPreferences');if (savedPrefs) { applyPreferences(JSON.parse(savedPrefs));}
Never expose API keys in client-side code. Always proxy requests through your backend.
Copy
// Bad: API key in clientfetch('https://api.everybite.com/smartmenu/graphql', { headers: { 'Authorization': 'pk_secret_key' } // Exposed!});// Good: Proxy through your backendfetch('/api/menu/search', { body: preferences });// Your backend adds the API key server-side
All communication with the SmartMenu API happens over HTTPS, which means every request—including the startSession mutation and X-Session-ID header—is encrypted in transit. No one can intercept or read these values as they travel between your servers and ours.IDs like guestId and passportId are passed once when you call startSession. After that, only the X-Session-ID header is needed on subsequent calls. Follow these best practices for the IDs you send:Use opaque identifiersUse random, meaningless strings rather than sequential numbers that could be guessed:
Never use personal information as IDsDon’t use email addresses, phone numbers, or other personal data as identifiers:
Copy
// Good: Opaque referenceguestId: 'lyl_8Hj2kM5pQ9'// Avoid: Exposes personal informationguestId: 'john.doe@email.com'
Hash IDs if you prefer not to share themIf you’d rather not send your internal customer IDs to EveryBite, you can hash them before sending. Use a consistent salt so you can still correlate analytics data later:
Copy
// Hash your internal ID before sendingconst hashedId = sha256(internalCustomerId + YOUR_SECRET_SALT);const guestId = hashedId;// You can always recreate the same hash to correlate data
As long as you’re proxying API calls through your backend (as recommended above), these IDs only travel server-to-server and are never exposed to end users.