How to use Canvas functions

Specific features of Canvas can be triggered manually through the use of Javascript functions.

These functions must be implemented directly on the website side, and will only work when the website is viewed inside the app.

Below you can find a list of all the available functions:

nativeFunctions.onesignalSendTags([$tags])
Adds an array of tags to the user profile in OneSignal

<button onclick="nativeFunctions.onesignalSendTags(['tag1', 'tag2', 'tag3'])">Add tags</button>

nativeFunctions.onesignalDeleteTags([$tags])
Removes an array of tags from the user profile in OneSignal

<button onclick="nativeFunctions.onesignalDeleteTags(['tag1', 'tag2', 'tag3'])">Remove tags</button>

nativeFunctions.onesignalSetExternalUserId($id)
Adds an external ID to the user profile in OneSignal

<button onclick="nativeFunctions.onesignalSetExternalUserId('123')">Add user ID</button>

nativeFunctions.onesignalRemoveExternalUserId()
Removes an external ID from the user profile in OneSignal

<button onclick="nativeFunctions.onesignalRemoveExternalUserId('123')">Remove user ID</button>

nativeFunctions.onesignalSetEmail($email)
Adds an email profile to OneSignal

<button onclick="nativeFunctions.onesignalSetEmail('[email protected]')">Add user email</button>

nativeFunctions.onesignalLogoutEmail()
Removes the current email profile from OneSignal

<button onclick="nativeFunctions.onesignalLogoutEmail('[email protected]')">Remove user email</button>

Related Articles

Download This Resource

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.