App Integration
Would you like to integrate Faslet with your native app? Our Size Me Up Virtual Assistant can provide you with data and endpoints in order to build your own native button. This guide will help you do that.
🚧Preview
Note that this feature is currently in preview. While we don't expect anything to change, please contact us before using it. We will work together to ensure a smooth transition to the final version.
Implementation
The proposed native app implementation is as follows:
- Add a button to your app that will trigger the Faslet Size Me Up Virtual Assistant
- In order to check the expected state of the widget, call the Assistant State API to determine whether the button should be shown, hidden or if a result is available, and to fetch the initial user ID that should be passed to the assistant.
- When the button is clicked, open a webview with normal web implementation of the Faslet Size Me Up Virtual Assistant, making sure to pass it the user ID from the previous step, and invoke
openWidget
method on thewindow._faslet
object - When the user data is changed in the widget, the
onDataChanged
callback will be called with the updated user data (see below) - Pass this user data back to the app and store it. This data will be used to calculate the size advice in future requests to the Assistant State API
As from our documentation on the window._faslet object, the callback is called with the following parameters:
interface Window {
_faslet?: {
onDataChanged?: (userData: {
userId: string
widgetVersion?: string
seenExperiments?: string
experimentVariants?: string
profile?: FasletUserProfile
}) => unknown;
}
}
Make a post call to the widget state endpoint with the required data
Help
In case of any questions, please don’t hesitate to contact us on support@faslet.me