A NodeJS example how to use an Experiment


  1. a key from API keys menu; example 36e82934fff945278268971cd3b4d32e.8911b9bc1e3f469a863a7e047cd51fdc
  2. an existing experiment; example id: 99afebd5-885e-48de-9789-704f7ff12437
  3. the name of the organization and project
  4. add our sdk
npm i @intempt/sdk

Define the configuration

const configuration = new IntemptSdk.Configuration({
  username: process.env.INTEMPT_USERNAME, // 36e82934fff945278268971cd3b4d32e
  password: process.env.INTEMPT_PASSWORD, // 8911b9bc1e3f469a863a7e047cd51fdc

Instantiate the experiments API

const experimentsApi = new IntemptSdk.CDPMetadata.ExperimentsApi(configuration);

Make the call

await experimentsApi.chooseVariant({  
  orgName: process.env.INTEMPT_ORG_NAME,  
  projectName: process.env.INTEMPT_PROJECT_NAME,  
  experimentId: '99afebd5-885e-48de-9789-704f7ff12437',  
  chooseVariant: {  
    userIdentifier: email