Node.js SDK Usage
User Object
The full user data must be passed into every method. The only required field is the user_id.
The rest are optional and are used by the system for user segmentation into Variables and Features.
DevCycleUser Typescript Schema
import { DevCycleUser } from '@devcycle/nodejs-server-sdk'
const user: DevCycleUser = {
user_id: 'user1@devcycle.com',
name: 'user 1 name',
customData: {
customKey: 'customValue',
},
}
const variable = devcycleClient.variable(user, 'test-feature', false)
In addition to the properties you set on the DevCycleUser yourself, these properties are automatically set by the SDK and are ready for segmentation:
| Property | Type | Description |
|---|---|---|
| platform | String | Platform/OS |
| platformVersion | String | Platform/OS Version |