Calling functions

When calling functions exposed by the app there's a special way of returning values to your website.

Calling function on integrations

If you want to call a function exposed by an integration, you should use dot notation to call the function on the integration.


If you want to call the function webAppIsReady on the app integration, you should do it like this:


Return values from method calls

To retrieve the result of a method call you’ll need a JavaScript method named the same as the method name + Result. The method must be placed in a scope which matches the scope of the called method minus Integration.

Let’s take an example:

If the following method is called from the website: PushNotificationIntegration.getLastPublishedToken();

the result of the method call will be returned through a call to PushNotification.getLastPublishedTokenResult. So the following must be defined in the website:

var PushNotification = {
    getLastPublishedTokenResult(token) {
        console.log('Push notification token received: ' + token);

The above method will be specified like this in the documentation on this site:

getLastPublishedToken(): string

The specification will also indicate the return type of the method even though there in practice won’t be returned a values from the method. Instead the return value will be given as a parameter for the corresponding Result method.