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:
<script>
(function () {const n = window,i = document,o = i.getElementsByTagName("script")[0],t = i.createElement("script");
(t.src = "https://js.appetize.io/embed.js"), (t.async = 1), o.parentNode.insertBefore(t, o);
const s = new Promise(function (e) {t.onload = function () {e();};});n.appetize = {getClient: function (...e) {
return s.then(() => n.appetize.getClient(...e));},};})();
</script>Embed your app
Add an iframe with an Appetize embed URL:
<iframe
id="appetize"
src="https://appetize.io/embed/<BuildId|PublicKey>"
width="378px"
height="800px"
frameborder="0"
scrolling="no"></iframe>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.
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