Object that holds state information about an embedded app and other actions
This is an instance of WebexAppsApplication
Readonly
contextThis context object can provide you with contextual information such as information about one of the following,
Meeting (context.getMeeting())
Space (context.getSpace())
Sidebar (context.getSidebar())
Instance that has information about a log class's state and other log related actions
This is an instance of ILog
Object that holds state information about a meeting and other meeting actions
This is an instance of WebexAppsMeeting
Instance that has information about a space's state and other space related actions
This is an instance of WebexAppsSpace
Readonly
application:displayFired when the rendering context of the application changes, for example, when a user pops out the app from the sidebar to a new window. Event object contains the app's new display context.
Possible values for meeting-based apps are one of,
MEETING_SIDEBAR
MEETING_STANDALONE_WINDOW
MEETING_MAINVIEW (for meeting-based apps)
Possible values for meeting-based apps are one of,
Note - This event is currently not emitted by messaging-based apps
Available since 1.1.0
app.onReady().then(() => {
app.listen()
.then(() => {
app.on("application:displayContextChanged", (event) => {
console.log("Display context changed. New display context:", event);
})
})
.catch((reason) => {
console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]);
});
});
Readonly
application:shareFired when an Open Together session is started or ended by the user. The event object is a boolean that's set to true
if an Open Together session has just started, or false
if a session has just ended.
Available since 1.1.0
const app = new webex.Application();
app.onReady().then(() => {
app.listen()
.then(() => {
app.on("application:shareStateChanged", (event) => {
console.log("Share state changed. Sharing state is:", event);
})
})
.catch((reason) => {
console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]);
});
});
Readonly
application:themeFired when the user selects a new application theme. The event object is a string indicating the newly selected theme.
Possible values are LIGHT
and DARK
.
Available since 1.1.0
app.onReady().then(() => {
app.listen()
.then(() => {
app.on("application:themeChanged", (event) => {
console.log("Theme changed. New theme:", event);
})
})
.catch((reason) => {
console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]);
});
});
Readonly
application:viewThis event is fired when the application view changes.
Possible values are IN_FOCUS and OUT_OF_FOCUS.
Available since 2.0.0
app.onReady().then(() => {
app.listen()
.then(() => {
app.on("application:viewStateChanged", (viewState) => {
console.log("View State Changed. Current state:", viewState);
})
})
.catch((reason) => {
console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]);
});
});
Contains general information about the client app (Webex or Meeting Center) in which the app is running. This format is subject to change and should only be used for diagnostic purposes.
Available since 1.1.0
Indicates the capabilities of the device on which the embedded app is running.
Can be combination of the following: "TOUCH", "SHARED_SYSTEM", "MULTIPLE_USER_SYSTEM", and "VIEW_ONLY".
Currently not in use and subject to change. An empty string array is currently returned.
Available since 1.1.0
The given device form factor. One of the following:
"DESKTOP" - Desktop client
"MOBILE" - Mobile device client (iPhone or Android device, for example)
"BROWSER" - Web browser client
"ROOM_SYSTEM_PERSONAL" - Webex Device running in personal mode
"ROOM_SYSTEM_SHARED" - Webex Device running in shared mode (currently not supported)
Available since 1.1.0
Display context in which the embedded app is running.
Can be one of the following strings "MEETING_SIDEBAR", "MEETING_STANDALONE_WINDOW", "MEETING_MAINVIEW", or "SPACE_TAB".
The default is "MEETING_SIDEBAR" for meeting-based apps and "SPACE_TAB" for messaging-based apps.
Available since 1.1.0
Indicates the actual version of the SDK embedded in the client following semantic versioning rules. The webex.Application.sdkVersion property provides the maximum SDK version that the client implements.
Available since 1.1.0
Indicates if the app has access to personally identifiable information for the current user, meeting, or space (true
), or if those values are empty or derived (false
).
See Personally Identifiable Information (PII) and Embedded Apps for more information about derived PII values.
Available since 1.1.0
Indicates if the URL specified with a previous call to setShareUrl() has been shared in a meeting or space by the user clicking Open Together or Add to Tab. A value of TRUE
indicates the URL has been shared; FALSE
indicates the URL has not been shared.
Available since 1.1.0
Contains the ISO-639 language code of the language being used by the client (for example, "en-US", "da-DK", etc.).
Available since 1.1.0
Indicates the maximum SDK version that the client (Meeting Center or Webex app, for example) implements, following semantic versioning rules. For example, a value of "1.1.0" might be returned for Meeting Center client versions 41.6-41.9. The webex.Application.embeddedSdkVersion property contains the actual version of the SDK embedded in the client.
Available since 1.1.0
Indicates the color theme that the user has selected for Webex or Meeting Center. Possible values are Theme.LIGHT
or Theme.DARK
.
Available since 1.1.0
Clears the URL previously set using setShareUrl() and removes the Open Together or Add to Tab button.
Available since 1.1.0
const app = new webex.Application();
await app.onReady();
app.clearShareUrl()
Initiates a single sign-on (SSO) authentication flow with a third-party identity provider in the system web browser at the specified URL. Returns a promise containing an OAuth authorization code from the ID provider, or a error code number.
WARNING
initiateSystemBrowserOAuth
is not supported in Webex for Government (FedRAMP).
In addition to any OAuth parameters required by the ID provider, the specified URL's redirect_uri query parameter must be set to https://oauth-helper-prod.wbx2.com/helperservice/v1/callback.
This callback correlates the authorization code returned by the identity provider with the embedded app that initiated the OAuth flow, and communicates that information back to your embedded app.
Notes:
The Valid domains configuration option for your embedded app must include the domain for the SSO page URL you pass to initiateSystemBrowserOAuth()
(accounts.example.com, for example).
{Promise.<string | number>} - Authorization code that the embedded app can exchange for an ID or access token from the SSO provider.
// Variable to save authorization code
let authCode;
// Initiate SSO flow
app.initiateSystemBrowserOAuth("https://accounts.example.com/auth?client_id=...&redirect_uri=https://oauth-helper-prod.wbx2.com/helperservice/v1/callback")
.then(function (response) {
// Get authorization code from JSON response
console.log("initiateSystemBrowserOAuth() succeeded")
authCode = response;
// Exchange authorization code for a token with the SSO provider. This part of the OAuth flow
// is the responsibility of the embedded app, e.g.
exchangeCodeForToken(authCode);
})
.catch(function (reason) {
console.error("initiateSystemBrowserOAuth() failed with reason=",
window.webex.Application.ErrorCodes[errorcode]
);
}
Available since 1.5.0
Parameterized URL that's opened in the system web browser to initiate the SSO process. The URL's redirect_uri
parameter must be set to https://oauth-helper-prod.wbx2.com/helperservice/v1/callback
. (Max length: 2083 characters).
Helper function that returns true
if the client (Webex or Meeting Center app) supports a given version
of the embedded apps SDK. The framework supports major.minor
and major.minor.patch
versioning.
For example, "1.4" and "1.4.1" are valid version string formats, but "1" or "1.4.5.1" are not.
Also note that "1.4" is identical to "1.4.0".
{boolean}
Available since 1.5.0
SDK version required by the API.
Used to register an event listener for a specified event. Either returns a successful Promise indicating that your app is ready to listen for events, or a failed promise indicating an error occurred. The listener must be registered after the app.onReady()
promise has successfully completed.
app.onReady().then(() => {
log('onReady()', { message: 'host app is ready' })
app.listen().then(() => {
app.on('space:infoChanged', (payload) => log('space:infoChanged', payload));
})
});
{Promise.<void>}
Available since 1.1.0
Name of the event to stop listening to.
Registers a listener function to be called when the specified event is raised. Your app must first call app.listen() before registering listeners for specific events.
Available since 1.1.0
One of the supported events.
Function called when a given event is raised. Callback function will be passed the an event object containing details about the event.
Called when the webex.Application
object has been initialized and the SDK is ready for use by your app.
{Promise.<void>}
Available since 1.1.0
app.onReady().then(function () { console.log('App is ready. App info:', app); }); ```
Opens an HTTPS or custom protocol URL in the default system browser.
The specified URL must use https:
or a custom protocol, such as webexteams:
(to open the Webex app) or mailto:
(to open the default mail app).
HTTPS URLs are validated against the list of allowed domains specified by the
embedded app's configuration options.
If a URL's domain doesn't match one of the app's allowed domains, or if it uses the http:
protocol,
then the call fails and an ACCESS_DENIED
error is returned.
For URLs that specify custom protocols, the user is presented with a dialog asking them to
allow or deny the request to open the app associated with the specified protocol. If the
user clicks Open external link then Webex opens the associated app. Users can optionally
save their preference to always open the associated app. User preferences are
stored in local storage. If the user clicks Cancel then the call fails
and an ACCESS_DENIED
error is returned.
{Promise.<void>}
Available since 1.4.0
The URL to open in the system's default browser.
Sets the URL to share in a meeting or space. Calling this method in a meeting causes the Open Together button to appear. In a space, calling this method causes the Add to Tab button to appear.
{Promise
0 = SUCCESS, 1 = GENERIC_ERROR, 2 = INVALID_ARGUMENT
Available since 1.1.0
Required. URL to share with meeting participants, or add as a tab to a space. The application at the specified URL must integrate with the embedded app framework. (Maxiumum length: 2083 characters)
Optional. URL of a version of the application for viewing outside of Webex or Meeting Center (i.e. in a standard web browser). This URL is used in a messaging space when a user selects Open in Browser or Copy URL from your app's space tab menu. Pass an empty string (""
) for this parameter if you don't want users to open an external version of your app from a messaging space. This value is currently not used by in-meeting apps. (Max length: 2083 characters).
Required. Title of the application window for an in-meeting app, or of the tab for an in-space app. (Max length 256 characters.)
Main webex.Application object. You use this object to obtain information about the application and its context, specify URLs for sharing, and register event listeners.
Example
Remarks
Available since 1.1.0