This guide details how to create an SDK Feature Rule in Zephr.
SDK Features allow you to share information with Zephr’s Decision Engine and receive a response detailing the outcome your Site, App, or CDN should take for an individual user.
Creating SDK Features
To create an SDK Feature, navigate to Products > Features within your Zephr Admin Console, then click Add a Feature.
Give your feature a Title and optional Description. Then, under Type of Integration, select SDK.
You will now see the SDK Developer Interface, which contains the tools needed by a developer to integrate with Zephr’s SDK.
The slug for your SDK rule will be autogenerated based upon the name of your Feature but can be edited by clicking into the text field.
The inputs section determines the information you will feed Zephr in order for it to make its decisions.
By default, we have options for Session, IP Address, User Agent, Path and Content ID – all of which are commonly used by our clients when building custom user journeys.
These are toggled on by default. If you will not be providing Zephr with any of this information, simply toggle the relevant item to off.
Zephr also allows Custom Inputs, where you can specify the information you will provide for use in our Decision Engine.
To create a custom input, click the Add Input button.
Give your custom input a Title and Key, then select the Type of input – either a string, number, or boolean.
Next, you will need to set the Output options for the rule. This will determine the outcomes available to you when building your customer journeys in the Zephr Rule Canvas – similar to Outcomes in HTML Features, and Transformations in JSON Features.
To add an Output, select the Output Type – either Enum, String, or Number.
If you select Enum, click the Add Option button.
Give your Output a Title and Value, then click Add. Repeat as necessary.
Installing the SDK
You will need to have the Zephr SDK install to be able to run SDK Feature Rules.
To install the Zephr SDK, run the following NPM command:
npm install @zephr/sdk
The details in the Usage section are provided as a guide for integrating with your application code.
Building your Rule
Once you’ve completed work on the Developer Interface, click Update & Lock. You can always return to this screen by clicking into the Developer Interfaceabove or below the Zephr Rules Canvas.
You can now complete your Zephr Feature Rule the same way you would be an HTML or JSON rule, with the slight difference that the Decision Points and Outputs available to you are based upon the Inputs and Outputs you’ve specified in the Developer Interface above.
Once your rule is complete, save and publish it as usual.