SDK

Customizations

In this page we'll dive deeper into several aspects of our HTML 5 library that can be customized to match your needs.

Configure library programmatically

Instead of relying on the config.json file, it is possible to set all these properties in code:

let notificare = new Notificare({
    "appHost": "YOUR_DOMAIN_HERE",
    "appVersion": "1.0",
    "appKey": "YOUR_APP_KEY_HERE",
    "appSecret": "YOUR_APP_SECRET_HERE",
    "ignoreNonWebPushDevices": false,
    "allowOnlyWebPushSupportedDevices": false,
    "serviceWorker": "sw.js",
    "serviceWorkerScope": "./",
    "googleMapsAPIKey": "PUT_GMAPS_KEY_HERE",
    "geolocationOptions": {
        "timeout": 60000,
        "enableHighAccuracy": true,
        "maximumAge": 100000
    }
});

appHost

This property is mandatory and should reflect the fully qualified host of your website (e.g.: https://example.com)

appVersion

This property is mandatory and should reflect a version of your website (e.g.: 1.0)

appKey

This property is mandatory and should be the Application Key you find in the Settings > App Keys area, in our dashboard.

appSecret

This property is mandatory and should be the Application Secret you find in the Settings > App Keys area, in our dashboard.

ignoreNonWebPushDevices

This property is optional and when present and set to true it will indicate our library that it should not register users that do not accept push notifications. If set to true, you should not use any other feature of our library.

allowOnlyWebPushSupportedDevices

This property is optional and when present and set to true it will indicate our library that it should not initialize if users are visiting your website in devices that do not support push notifications. If set to true, you should not use any other feature of our library.

serviceWorker

This property is mandatory and it should reflect the path to the service worker file you're hosting in your server.

serviceWorkerScope

This property is optional and when present with a value it will be use to configure the scope of your service worker.

googleMapsAPIKey

This property is mandatory if you want to use location services. It should be a valid Google Maps API Key.

geolocationOptions

This property is optional and when used it will be used by our library to configure the usage of the Geolocation API. For more information please read the following documentation.

Customizing text for Action's UI

Some actionable notifications may contain text in its UI. By default all those texts will be in English. However you can customize it by passing the following values when instantiating the library:

let notificare = new Notificare({
    "UI": {
        "text": {
            "keyboard": "Type a reply",
            "next": "Next",
            "send": "Send",
            "cancel": "Cancel",
            "close": "Close",
            "camera": "Take a Picture"
        }
    }
});