- DarkLight
The Gong frontend integration allows you to display your HTML content in an iFrame in Gong. To set up this application complete the following steps:
Ensure you have credentials to log into your Gong Sandbox
Submit details of the integration as described in Create an app for Gong.
Create your app and test it.
Update your integration details in Gong if needed.
Publish the app in the Gong Collective. Your customers can then install the app on their instance of Gong, and their reps can then embed your HTML content to their emails.
Terminology
Partner: a web application that would like to integrate with Gong
Gong user: user with credentials both in Gong and the partner’s system.
Gong administrator: Gong user who can set up integrations in Gong
Gong Public JavaScript Frontend SDK: Javascript SDK that will be published by Gong and used by the Partner application
Set up your Gong integration
Provide Gong with information on the integration. Fill in the form as described in Create an app for Gong. To create a frontend integration set the following:
Label and image for the button that activates the integration in the composer
Domains: the registered domain for the partner application. All origins configured later (here and in the tenant sub domains section) must be under this domain otherwise they will be rejected. Example: partner.com, partner-integration.com
iframe Integration: set the toggle to on
Check the Email composer checkbox and provide the URL that Gong should use to launch the iframe
Allowed origins: a list of https origins that can be loaded inside the iframe. Any other origin will be rejected by Gong. Examples: https://recorder.partner.com, https://recorder.partner.com, https://login.partner-integration.com
The wildcard * origin is not allowed
3rd party origins are not allowed
If you need to register tenant sub domains, set up OAuth access and save the
api_base_url_for_customer
string you received when calling thegenerate-customer-token
endpoint so that you can provide it when calling the init function.Publish your app: This uploads your app to the Gong Collective and customers wwill be able to install the app. This step should be done when you've tested your app and it is ready to be used.
Create your Gong email composer app
Create a web application that will run inside an iframe in the Gong application.
Note: The iframe runs in sandbox mode so the following actions are allowed:
allow-forms
allow-scripts
allow-same-origin
allow-popups
Install the Gong SDK in your app
In your app, run
npm i @gong.io/frontend-sdk
Building the app
The app should be set up as follows:
When the iFrame is activated, the Partner page can authenticate the user. The iframe sandbox includes:
allow-popups
token so that the iframe can open a new windowallow-same-origin
token so that the iframe can access cookies for the partner domain
The app should run the following functions in order to display data in the email composer:
When ready, call the
ready()
function to notify it loaded successfullyCall the
close()
function to close the iframe without embedding content (e.g. the user canceled)Call the
closeWithContent()
function, passing the HTML content as string to display the content in the Email composer.
Once the Partner page sends back content, the iframe closes. Gong sanitizes the content and embeds it in the email draft.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>gong frontend partner sdk example</title>
</head>
<body>
<div>
<h1>Gong frontend partner sdk example</h1>
<p>Example of how to use Gong Partner SDK to interact with Gong</p>
<div class="card">
<textarea style="width:200px;height:50px" id="textArea">
<div><p>partner generated content</p></div>
</textarea>
<button id="button" onclick="embedContentAndClose()">embed content and close
</button>
</div>
</div>
<script>
import {
init,
GongFontendApi,
} from "gong-partner-sdk/dist/collective-api";
// STEP1: initialize the Gong Partner SDK passing down reference to the gongWindow
const api = init({
gongWindow: window.parent,
});
// STEP2: Call ready method to let Gong know that the app is ready to interact with it
api
.ready()
.then(() => {
console.log("Gong is ready to interact with the app!");
})
.catch((error) => {
console.error(
"Gong partner SDK should run inside of Gong application",
error
);
});
// STEP3 (optional): use closeWithContent method to send a message to Gong
function embedContentAndClose() {
const htmlContent =
document.querySelector < HTMLButtonElement > "#textArea".innerText;
api.closeWithContent({ html: htmlContent });
}
</script>
</body>
</html>
Registering tenant sub domains
If you need to load a different sub domain for each tenant (e.g. acme.partner.com), you can register multiple sub domains per tenant:
Make sure OAuth access is set up.
The OAuth flow is launched when the integration is activated.
Use the access token received when running the generate-customer-token endpoint to call the /integration-settings endpoint to register sub-domains.
Test the app in your sandbox account
Log in as tech admin to your Gong sandbox account and add the integration.
Adding data to the email composer
Once you have published the integration, if a Gong user is writing an email via the Gong email composer, they can include your suggested content in the email by clicking the Integrations icon and selecting your integration. Gong opens an iFrame with the URL you supplied when creating the application.
Troubleshooting: Why my data isn’t displaying
If your data is not being added to the email composer, check the following:
The iFrame loads content from origins configured in Gong. 3rd party domains are blocked.
To use a 3rd party domain for authentication it should be opened in a new window.
Dynamic domains (e.g. https://customer.partner.com) must be registered using the Gong Public API. If they are not registered, the domain will be blocked.
The HTML content is sanitized. This includes removing any javascript content.
The email composer accepts only a subset of HTML elements and has some further restrictions on styling. The content will be sanitized to remove any javascript and elements that are not allowed.
The allowed elements are (this can change in the future): a, br, div, em, hr, img, li, ol, s, span, strong, u, ul