JavaScript SDK
Our JavaScript SDK offers an API to programmatically interact with Appetize devices. This allows you to automate interactions with the device, verify app behavior, and more.
Installation
First, load the JavaScript SDK by adding the following snippet to the head
section of your page:
Embed your app
Add an iframe
with an Appetize embed URL:
We gave the iframe an id of appetize
, but it can be anything you wish.
Get the Client
The easiest way to get the client is by calling window.appetize.getClient(selector)
.
This will return an Appetize client instance for the embed e.g.
We also support getting the client with an initial configuration - for scenarios where the initial embed link might not be known on launching of the page (no src
specified on the iframe
) by making use of window.appetize.getClient(selector, config)
.
This will return an Appetize client instance with the initial configuration applied e.g.
The base URL can be changed with a data-appetize-url
attribute, e.g. data-appetize-url="https://sampledomain.appetize.io"
Starting a Session
You can start a session programmatically:
or wait for the user to click "Tap to Play":
Next we'll cover various ways you can configure the embed, such as the device or OS version.
Last updated