Example Scripts¶
The scripts below are executed by the Extension Engine during Custom Registration.
Refer to the Extension Engine documentation for help writing scripts.
Init Script¶
function execute(requestPayload) {
return {
status: 2000,
responsePayload: ""
};
}
Complete Script¶
The complete script requires a user
object with an id
property defined to be returned.
function execute(requestPayload) {
var userId = "userId_" + Date.now();
return {
status: 2000,
user: {
id: userId
}
};
}
Backchannel Communication Script¶
function execute(requestPayload) {
var userId = requestPayload.userId;
var uniqueIdentifier = userId + "_" + Date.now();
CACHE.store(uniqueIdentifier, userId); //Another script could use CACHE.fetch(...) to retrieve the stored value
return {
status: 2000,
responsePayload: uniqueIdentifier
};
}
Status Codes¶
When writing a custom script, these status code ranges should be used.
Status | Description |
---|---|
2xxx | Success |
4xxx | Failed, user can try again |
5xxx | Failed, cleanup actions should be triggered and user must start at beginning again |