MonetizationOS Docs
Workflows ReferenceType Definitions

WriteIdentityWorkflowUtils

type WriteIdentityWorkflowUtils = WriteIdentityLinksWorkflowUtils & {
  deleteCustomData: (identifier, key, options?) => Promise<void>;
  incrementCounter: (identifier, counter, options?) => Promise<void>;
  writeCustomData: (identifier, key, value, options?) => Promise<void>;
};

Type Declaration

deleteCustomData()

deleteCustomData: (identifier, key, options?) => Promise<void>;

Delete an item of custom data against a user or session. If the data was written with the 'crossBrand' option, that must be passed here too to delete the value.

Parameters

ParameterTypeDescription
identifierWorkflowUserIdentifierThe user or session to delete the data against.
keystringThe key to delete. Must be a non-empty string of less than 1000 characters.
options?CustomDataOptionsOptional settings for the operation.

Returns

Promise<void>

Example

 await utils.identity.deleteCustomData(identity, 'user-profile')

incrementCounter()

incrementCounter: (identifier, counter, options?) => Promise<void>;

Increment the counter backing a meter.

Parameters

ParameterType
identifierWorkflowUserIdentifier
counter{ counterId: string; }
counter.counterIdstring
options?{ increment?: number; }
options.increment?number

Returns

Promise<void>

Examples

await utils.identity.incrementCounter(identity, featureSchema['my-feature'].enabled)

await utils.identity.incrementCounter(identity, { counterId: 'my-custom-counter' })

writeCustomData()

writeCustomData: (identifier, key, value, options?) => Promise<void>;

Write an item of custom data against a user or session. Data will be available for this brand only, unless the 'crossBrand' option is set to true, in which case it can be retrieved by any brand by passing the 'crossBrand' option when reading.

Parameters

ParameterTypeDescription
identifierWorkflowUserIdentifierThe user or session to write the data against.
keystringThe key to write the data against. Must be a non-empty string of less than 1000 characters.
valueNonNullable<unknown>The value to write. Must be non-null and less than 32kb when stringified.
options?CustomDataOptionsOptional settings for the operation.

Returns

Promise<void>

Example

await utils.identity.writeCustomData(identity, 'user-profile', { name: 'Joe Blogs' })