Initialize the SDK in your application
Initializing the SDKinit
on the AmazonConnectApp module. This takes an
onCreate
and onDestroy
callback, which will be invoked
once the app has successfully initialized in the workspace and then when the
workspace is going to destroy the iframe the app is running in. These are two of the
lifecycle events that your app can integrate with. See Lifecycle
events for details
on the other app lifecycle events that your app can hook into.
import { AmazonConnectApp } from "@amazon-connect/app"; const { provider } = AmazonConnectApp.init({ onCreate: (event) => { const { appInstanceId } = event.context; console.log('App initialized: ', appInstanceId); }, onDestroy: (event) => { console.log('App being destroyed'); }, });
Doing a quick test locally by loading your app directly will produce an error
message in the browser dev tools console that the app was unable to establish a
connection to the workspace. This will happen when your app is correctly calling
init
when run outside of the workspace.
> App failed to connect to workspace in the allotted time