Server-Side Experiments Implementation Guide
Call the Choose API to identify a user, resolve a server-side experiment or personalization, and apply the result in your backend.
Overview
Server-side experiments let you deliver personalized experiences and A/B test variations directly from your backend, instead of applying variations in the browser. Your backend calls the Choose API before rendering, and Intempt returns the variation or personalization to apply. This guide walks through identifying a user, calling the endpoint, and handling the result. For the concepts behind server-side delivery, see Server-Side Experiments Overview.
How it works
- Your backend identifies the current user.
- Your backend calls the Choose API before rendering.
- Intempt returns the matching Experience variation(s) as a
choicesarray. - Your backend applies the result before responding to the client: swap copy, set a feature flag, or insert structured data.
Getting started
-
Identify the user. Every request needs an
identificationobject, built one of two ways:sourceIdandprofileId:{ "identification": { "sourceId": 1575686747310551239, "profileId": "profile_c2daf740e3e9f7aa48c6f6563f192b81" } }Or a single
userId, if the user already has this identifier in Intempt:{ "identification": { "userId": "user_123456" } } -
Call the Choose API.
POST https://api.intempt.com/v1/{orgName}/projects/{projectName}/optimization/choose-api?apiKey=YOUR_API_KEYParameter Description orgNameYour Intempt organization name projectNameThe project where the Experience is configured apiKeyYour project API key, passed as a query parameter Resolve specific Experiences by name:
curl -X POST "https://api.intempt.com/v1/{orgName}/projects/{projectName}/optimization/choose-api?apiKey=YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "identification": { "sourceId": 1575686747310551239, "profileId": "profile_c2daf740e3e9f7aa48c6f6563f192b81" }, "names": ["demo-server-side-experiment", "demo-server-side-personalization-most-popular"], "device": "mobile", "sessionId": "sess_8f2a1c9d3e7b" }'Or resolve every Experience in a group:
curl -X POST "https://api.intempt.com/v1/{orgName}/projects/{projectName}/optimization/choose-api?apiKey=YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "identification": { "sourceId": 1575686747310551239, "profileId": "profile_c2daf740e3e9f7aa48c6f6563f192b81" }, "groups": ["my-group"] }'namesandgroupsare both optional and independent: passnamesto resolve specific Experiences,groupsto resolve everything in a group, or both in the same request.deviceacceptsall,desktop, ormobile.namesandgroupsentries can only contain letters, numbers, underscores, and hyphens. See Choose API reference for the complete field list, including the optionalproductIdandtimestampfields. -
Read the response. A successful call returns a
choicesarray, one entry per matched Experience:{ "choices": [ { "name": "demo-server-side-personalization-most-popular", "group": "my-group", "body": { "label": "My most popular products", "products": [ { "price": "250.0", "title": "PMC Bronze 9mm (FMJ) 124 GR. 1000 Rds.", "category": "Ammunition" } ] } } ] }choices[].bodyis the variation's configured payload; its shape depends on how the Experience was set up.choicesis an empty array if nothing matches. -
Apply the result in your backend. Intempt only returns the decision. It never modifies your UI automatically. Depending on how the Experience is configured, that means:
- Text or content replacement. Swap server-rendered copy before sending the response.
- Feature flags. Read a flag-shaped field from
bodyand branch your logic before rendering. - Structured personalization. Insert product lists or other structured data into HTML, an API response, or a mobile payload.
Match
choicesentries byname, never by array index, since a request can return more than one choice. -
Handle errors and fallbacks.
Status Meaning 400Invalid request. The response body includes an errorsarray with amessageper issue.404Not found. If the call fails or returns no choices, render your default experience. Define a fallback for every Experience before you rely on it in production.
Where to go next
- Server-Side Experiments Overview for the client-side vs. server-side comparison and the end-to-end flow.
- Choose API reference for the complete request and response field reference.
- Authentication and API keys for managing the key used in this request.
- Mobile experiments for configuring the Experience this endpoint resolves.
Slack
With the Slack destination, you can trigger notification messages and alerts via Journeys.
How to migrate from another ESP to Intempt
Intempt is a growth marketing platform that combines email, SMS, and push notifications with deep analytics and personalization. It helps businesses engage users, optimize conversions, and manage m...
