Technical reference
Entry point for the technical team that is going to integrate with Reskyt.
The push API is the public Reskyt API currently available.
| API | What for | Authentication |
|---|---|---|
| Push notifications | Send notifications from your systems | x-api-key |
If you need to integrate another way, it is usually solved from the web or through a module. See integrations and SDKs.
Detecting that you are inside the app
Section titled “Detecting that you are inside the app”Requests that leave the app include the rktwebview identifier in the
user agent. It is the reference check.
const isReskytApp = navigator.userAgent.includes('rktwebview');Custom User Agent
Section titled “Custom User Agent”You can define your own user agent to tell platforms apart in your analytics
or in your backend, with a tag of the form clientname_app_IOS or
clientname_app_ANDROID.
It is configured in Settings › Developer, with one field for iOS and one for Android.
The value you enter replaces the whole user agent. To keep the default user
agent, including the rktwebview identifier, write %useragent% in the value
and add your tag after it, for example %useragent% clientname_app_IOS. If
you leave out %useragent%, the rktwebview check stops working.
const ua = navigator.userAgent;const isIOSApp = ua.includes('_app_IOS');The window.ReskytLayout API
Section titled “The window.ReskytLayout API”Inside the app, your JavaScript has the window.ReskytLayout object
available, with methods to read device data and to ask the app to do things.
This section covers the most common ones. The full reference appears as
autocomplete and documentation in the backoffice JavaScript editor.
Waiting for the app to be ready
Section titled “Waiting for the app to be ready”ReskytLayout exists as soon as the page loads, but some methods only return
real data once the app has finished starting. Code configured from the
backoffice already runs with the app ready. If the code belongs to your own
website, wait first with whenReady():
if (window.ReskytLayout) { window.ReskytLayout.whenReady().then((ready) => { if (!ready) return; // the app did not start on this page // from here on you can use the other methods });}Device identifier
Section titled “Device identifier”ReskytLayout.device.getId() returns the device identifier, which is the
value sent in the deviceId field of the push API. It
returns a promise, and its value is null if the device is not registered
yet.
The recommended flow is to request it during login or sign-up, store it and associate it with the corresponding user in your systems. From then on that identifier is the one used to target sends.
if (navigator.userAgent.includes('rktwebview')) { window.ReskytLayout.device.getId().then((deviceId) => { if (deviceId) { // Store it associated with the user in your database. } });}Language and country
Section titled “Language and country”ReskytLayout.localization.getCurrentLocation() returns the zone, country and
language the user has selected in the app. Each value can be null if none
has been chosen.
const { zone, country, language } = window.ReskytLayout.localization.getCurrentLocation();To react when the user changes language or country:
window.ReskytLayout.localization.onLocationChange((location) => { console.log('New language:', location.language);});Unread notifications
Section titled “Unread notifications”ReskytLayout.notifications.getUnreadCount() returns how many notifications
the user has not read, for example to show a counter on your website.
const unread = window.ReskytLayout.notifications.getUnreadCount();
window.ReskytLayout.notifications.onUnreadCountChange((count) => { // Update your counter with the new value.});Asking for a store rating
Section titled “Asking for a store rating”ReskytLayout.ratings.requestReview() asks the system to show the App Store
or Google Play rating dialog, for example after a purchase. The operating
system decides whether to show it, so it may not appear.
if (window.ReskytLayout.ratings.isAvailable()) { window.ReskytLayout.ratings.requestReview();}Storing data on the device
Section titled “Storing data on the device”ReskytLayout.storage stores key and value pairs on the device itself.
Unlike localStorage, the data is shared by every domain the app opens.
Values are text, numbers or booleans, and the operations return promises.
async function rememberNewsletter() { const storage = window.ReskytLayout.storage; if (!storage.isAvailable()) return;
await storage.set('newsletter_seen', true); const seen = await storage.get('newsletter_seen'); // 'true', as text await storage.remove('newsletter_seen');}Consent
Section titled “Consent”ReskytLayout.consent reads and writes the user’s consent inside the app, so it
can be connected to the website’s cookie banner. See
consent and cookie banner.
Deep link parameters
Section titled “Deep link parameters”When a deep link opens the app that is already installed, the URL reaches the WebView in full, with all its parameters as they are.
Where to go next
Section titled “Where to go next”Integrations and SDKs explains the available integration routes and what each one involves in the publication cycle. The module catalogue lists what is already integrated.
Deep links covers Universal Links on iOS and App Links on Android. Authentication and sessions explains where the boundary of responsibilities lies in login.