Template definition

The template definition is done inside the file definition.json. A JSON schema is provided so that you can validate the correctness of the file. You can reference the JSON schema from withing the file, like this:

    {
        "$schema": "https://api.follow-apps.com/json-schemas/inapp-templates/v1_0_0.json"
    }

Once you have added the reference to the schema, your code editor will provide syntax highlighting and code completion assistance.

Definition in a code editor

Library options

The first section of definition.json contains meta data information about the template. These options will only be used for organising the library and they will not be transferred to the SDK and the final device.

 {
     "template_options": {
         "technical_name": "123"
     }
 }
 {
     "template_options": {
         "title": {
             "en": "A title",
             "fr": "Un titre"
         }
     }
 }
 {
     "template_options": {
         "description": {
             "en": "The description here.",
             "fr": "La description ici."
         }
     }
 }
 {
     "template_options": {
         "author": "My name here"
     }
 }
 {
     "template_options": {
         "version": "1.0.0"
     }
 }

SDK options

The second section of definition.json contains instructions on how the template will be displayed inside the device by the SDK.

 {
     "sdk_options": {
         "type": "popup"
     }
 }
 {
     "sdk_options": {
         "close_button": {
             "appear_timeout": 0
         }
     }
 }
 {
     "sdk_options": {
         "close_button": {
             "appear_timeout": "10"
         }
     }
 }     
 {
     "sdk_options": {
         "close_button": {
             "appear_timeout": "never"
         }
     }
 }     

Inputs

Field Types

String
 {
     "inputs": [
         {
             "type": "string",
             "default": "something",
             "min_lenght": 3,
             "min_lenght": 100,
             "lines": 3
         }    
     ]
 }     

String

Enum
 {
     "inputs": [
         {
             "type": "enum",
             "default": "test1",
             "values": [       
                 { "value": "test1", "caption": { "en": "test 1", "fr": "test 2" } },
                 { "value": "test2", "caption": { "en": "test 2", "fr": "test 2" } }
             ]
         }   
     ] 
 }         

String

Number
 {
     "inputs": [
         {
             "type": "number",
             "default": 15,
             "precision": 0,
             "min": 3,
             "max": 100
         }    
     ]
 }     

String

Boolean
 {
     "inputs": [
         {
             "type": "boolean",
             "default": true        //default value = false
         }    
     ]
 }     

String

Color
 {
     "inputs": [
         {
             "type": "color",
             "default": "#1ab9b1"
         }    
     ]
 }     

String

Image
 {
     "inputs": [
         {
             "type": "image",
             "default": "./image.jpg",
             "max_filesize": 10000000
         }
     ]
 }     

String

Video
 {
     "inputs": [
         {
             "type": "video",
             "default": "./video.mp4",
             "max_filesize": 20000000
         }
     ]
 }  

String

Groups

 {
     "inputs": [
         {
             "type": "group",
             "label": {"en": "my group"},
             "tooltip":{"en":"my tooltip"},
             "inputs": [
               // accepts all other inputs except for group and table
             ]
         }    
     ]
 }  

String

Tables

 {
     "inputs": [
         {
             "type": "table",
             "label": {"en": "my table"},
             "tooltip": {"en":"my tooltip"},
             "max_size": 3,
             "min_size": 1,
             "inputs": [
               // accepts all other inputs except for group and table
             ]
         }    
     ]
 }  

String

Pages

 {
     "inputs": [
         {
             "type": "pages",
             "label": {"en": "my pages"},
             "tooltip": {"en":"my tooltip"},
             "min_pages": 1, // default = 1
             "max_pages": 3, // default = undefined
             "inputs": [
               // accepts all inputs except for pages
             ]
         }    
     ]
 }  

String

String