JavaScript Extension

Use JavaScript directly on top of your Seismic tenant

Purpose

The JavaScript Extension allows you to invoke JavaScript from a Seismic tenant. Common use cases include:

  • Chatbots, Helpbots, and Rate Your Experience overlays
  • Creating a link to an external service

❗️

Security

Include any custom javascript at your own risk. By including code, you understand and acknowledge any risks associated with including custom JavaScript into the application. For more information on custom JavaScript risks, see the following resources:

https://css-tricks.com/potential-dangers-of-third-party-javascript/
https://www.adpushup.com/blog/using-third-party-javascript/
https://blog.detectify.com/2017/02/02/the-danger-of-third-party-scripts/

Prerequisites

  • There are no prerequisites within the app configuration

How it works

When it's triggered

If the app is installed and enabled in a tenant, the JavaScript extension is called upon loading the Seismic tenant into your web browser. This includes mobile browsers, but not from within the Seismic mobile apps.

What's running

The code that you've provided to the extension from within your settings is executed. Seismic administrators control which users are impacted via the App Permissions settings.

if (window.sessionStorage.getItem('seismicUserInfo')) {
            var imageDiv = document.getElementById("ExternalImageDiv");
            if (imageDiv != null) {
                document.body.removeChild(imageDiv);
            }

            imageDiv = document.createElement("div");
            imageDiv.innerHTML = "<div style=\"z-index: 10018;position: fixed;bottom: 10px;right: 50px;\"><a href=\"https://developer.seismic.com/seismicsoftware/\" target=\"_blank\"><img alt=\"external link\" src=\"https://files.readme.io/3beee2e-small-202b8f5-small-SeismicForDevelopers.png\"\></a></div>";
            document.body.appendChild(imageDiv);
        }

What's expected

The JavaScript should perform any actions that you have told it to do.
The above code sample places a linked image onto the bottom right of your Seismic tenant. When they click on this link, it will route them to the URL provided.

Sample JavaScript overlaySample JavaScript overlay

Sample JavaScript overlay

📘

Deep Linking

Any script which is included should not rely on any aspect of the Seismic platform in order to function. The dependence on any Seismic javascript libraries, DOM elements, CSS classes, or page URLs is not supported. In other words, don't try to deeply inject into the application, rather, inject only in top level elements such as the head and body.

How to Configure

Configure the UI Extension Point

  • Add the JavaScript Extension to your application as described here
  • Input an Extension Instance Name
  • Paste your JavaScript into the JavaScript Code Editor
  • Click Save Changes
  • Make sure to enable the extension point and click Save Changes

Troubleshooting

  • Ensure the extension point is enabled within your app

  • The app will need to be upgraded in the tenants where it has been installed after making a change

  • It can sometimes take between 5 and 30 minutes for the changes to be visible in the tenant

  • Authentication and Scopes are NOT required for this app to function


Did this page help you?