Guides
Add the widget to an app without a web address
Use the app key when your page has no web address, like an Electron app that loads its page from a file.
Pass the app key
Section titled “Pass the app key”A page without a web address, such as an Electron app that loads its page with loadFile, has no web origin. Depending on the request, Electron sends Origin: null, Origin: file:// or no Origin at all. Iris lets such a page in only with your workspace’s app key. Copy the App key from Settings → Install and pass it next to appId:
Iris.init({ appId: "app_7Hq2xK9mPz", appKey: "app_key_4f1c9a0b2d7e4c6a8b3f5e1d9c7a2b40" });Nothing else changes: keep loadFile, and load the SDK with the same snippet as on a website. Agent replies arrive live, as on a website.
- The app key is public, not a secret. It ships inside your app.
- It works for every page without a web origin:
file://, a custom scheme such asapp://my-app, or noOriginat all. A website always follows the allowed origins, with or without the key. - To identify users, call
Iris.identifyas on a website. Your server still signs the identity token. - A React Native app passes the key in the URL of the chat page. See React Native.
Turn off or regenerate the key
Section titled “Turn off or regenerate the key”An admin can turn the key off or regenerate it in Settings → Install. New sessions with the old key fail at once. A contact who has the widget open keeps it for up to an hour. After you regenerate the key, release an update of your app with the new key.
A custom scheme still works
Section titled “A custom scheme still works”If your app serves its page from its own privileged scheme, such as app://my-app, you can add that origin in Settings → Widget → Allowed origins instead of passing the key.