Preset settings
With the preset settings you can customize:
- Which project preset and palette to use
- The remember user configuration
- The Riddle language
- When the Riddle automatically opens and closes
- The Riddle and block timer
Default case
If no preset setting is specified and the Riddle is created in a project (!) the default preset and its selected palette will be used for the built Riddle.
Click here to learn how to set a default preset for your project.
Specifying preset settings
The preset settings properties are sent in the preset
property of the build object. If we now for example want to use a preset and palette from our project the request would look like this:
{
"blocks": [...],
"preset": {
"preset": 805,
"palette": "Zymx"
}
}
Retrieving preset and palette IDs
Retrieving your project's presets and associated palettes is possible through the Builder API presets endpoint. An example response looks like this:
{
"success": true,
"code": 200,
"data": [
{
"id": 805,
"name": "My project preset",
"palettes": [
{
"id": "Zymx",
"name": "my palette"
}
]
}
]
}
Add remember user configuration
'Remember user' means writing the user's answers to the local storage, meaning that the user doesn't have to input their name or email again when revisiting the Riddle / website.
Properties
Property | Required | Type | Description | Default |
---|---|---|---|---|
isEnabled | ✓ | boolean | Whether the remember user feature is enabled or not | false |
isAutoSubmitEnabled | boolean | if true, the form will be submitted automatically when the user returns to the Riddle | true | |
isDsgvoAccepted | boolean | Whether the user has accepted the DSGVO | false | |
isUserPermissionRequired | boolean | Whether the user has to give permission to store their data in local storage | true |
Example object
{
"blocks": [...],
"preset": {
"rememberUser": {
"isEnabled": true,
"isAutoSubmitEnabled": false,
"isDsgvoAccepted": true,
"isUserPermissionRequired": false
}
}
}
Changing Riddle language
The language of the Riddle can be changed by setting the language
property in the preset settings. The language must be a two-letter ISO code, e.g. 'de' for German, 'en' for English, 'fr' for French, etc.
Example object
{
"blocks": [...],
"preset": {
"language": "de"
}
}
Opening the Riddle at a set time
Opening the Riddle at a set time can be done by setting the autoOpenDate
property in the preset settings. The value must be a date in the format 'YYYY-mm-dd HH:ii:ss', e.g. '2023-10-01 00:00:00'. Please note that the provided date must be in the timezone Berlin (GMT+2).
Example object
{
"blocks": [...],
"preset": {
"autoOpenDate": "2099-10-01 00:00:00"
}
}
Closing the Riddle at a set time
Closing the Riddle at a set time can be done by setting the autoClose
property in the preset settings. The property is an object with the following properties:
Property | Required | Type | Description | Default |
---|---|---|---|---|
date | ✓ | string | The date when the Riddle should close. The value must be a date in the format 'YYYY-mm-dd HH:ii:ss', e.g. '2023-10-01 00:00:00'. Please note that the provided date must be in the timezone Berlin (GMT+2) | |
resultId | integer | The ID of the result that should be shown when the Riddle is closed. Use 1 for the first result, 2 for the second result, ...; by default the first result is shown | 1 |
Example object
{
"blocks": [...],
"preset": {
"autoClose": {
"date": "2099-10-01 00:00:00",
"resultId": 1
}
}
}
Setting Riddle timer
The Riddle timer is a limit on how long the user has to complete the Riddle.
Properties
Property | Required | Type | Description | Default |
---|---|---|---|---|
timeLimit | ✓ | integer | The time limit in seconds | |
pauseOnNonQuestionBlocks | boolean | Whether the timer should pause on non-question blocks, such as Form blocks | true | |
warningAt | integer | The time in seconds when the warning should be shown. The warning is a message that tells the user how much time they have left | 10 | |
format | string | The format of the timer. Allowed values: s (Seconds as number), m_s (Minutes:Seconds), x_m_x_s (X minutes Y seconds) | s | |
shape | string | The shape of the timer. Allowed values: circleTimer , barTimer | barTimer |
Example object
{
"blocks": [...],
"preset": {
"riddleTimer": {
"timeLimit": 60,
"pauseOnNonQuestionBlocks": true,
"warningAt": 10,
"format": "s",
"shape": "circleTimer"
}
}
}
Setting block timer
The block timer is a limit on how long the user has to complete a block. The time limit can be set either per block or globally for all blocks.
Properties
Property | Required | Type | Description | Default |
---|---|---|---|---|
timeLimit | ✓ | integer | The time limit in seconds; not required when individualBlockTimes is set | |
pauseOnNonQuestionBlocks | boolean | Whether the timer should pause on non-question blocks, such as Form blocks | true | |
warningAt | integer | The time in seconds when the warning should be shown. The warning is a message that tells the user how much time they have left | 10 | |
format | string | The format of the timer. Allowed values: s (Seconds as number), m_s (Minutes:Seconds), x_m_x_s (X minutes Y seconds) | s | |
shape | string | The shape of the timer. Allowed values: circleTimer , barTimer | barTimer | |
individualBlockTimes | int | An array of integers that specify the time limit for each block. The order of the blocks is the same as in the blocks property of the build object. The length of the array must be equal to the number of blocks in the Riddle |
Example objects
Setting a global block time limit:
{
"blocks": [...],
"preset": {
"blockTimer": {
"timeLimit": 60,
"pauseOnNonQuestionBlocks": true,
"warningAt": 10,
"format": "s",
"shape": "circleTimer"
}
}
}
Setting a block time limit for each block:
{
"blocks": [
{
"title": "Solve this Riddle: What is the capital of France?",
"type": "SingleChoice",
"items": {
"Paris": true,
"Berlin": false,
}
},
{
"title": "Solve this Riddle: What is the capital of Germany?",
"type": "SingleChoice",
"items": {
"Berlin": true,
"Paris": false,
}
},
]
"preset": {
"blockTimer": {
"individualBlockTimes": [60, 30]
}
}
}