import { HostEvent } from '@thoughtspot/visual-embed-sdk';
// Or
// const { HostEvent } = window.tsembed;
// create the liveboard embed.
liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
{ columnName: 'state', operator: RuntimeFilterOp.EQ, values: ["california"]}
]);
HostEvent
- Index
- Enumeration members
- AIHighlights
- AddColumns
- AddToCoaching
- AnswerChartSwitcher
- AskSage
- AskSpotter
- CloseSpotterShareConversation
- CloseSpotterVizPanel
- CopyLink
- CreateMonitor
- DataModelInstructions
- Delete
- DeleteLastPrompt
- DestroyEmbed
- Download
- DownloadAsCsv
- DownloadAsPdf
- DownloadAsPng
- DownloadAsXlsx
- DownloadLiveboardAsContinuousPDF
- DrillDown
- Edit
- EditLastPrompt
- EditLiveboard
- EditTML
- EditVisualization
- ExitEditMode
- ExitSpotterSharedConversation
- Explore
- ExportTML
- GetAnswerSession
- GetFilters
- GetGroups
- GetIframeUrl
- GetParameters
- GetTML
- GetTabs
- InitSpotterVizConversation
- LiveboardInfo
- MakeACopy
- ManageMonitor
- ManagePipelines
- Navigate
- OpenAddFilterModal
- OpenAddParameterModal
- OpenFilter
- OpenParameter
- OpenSpotterVizPanel
- Pin
- PinSpotterConversation
- Present
- PreviewSpotterData
- RefreshLiveboardBrowserCache
- Remove
- RemoveColumn
- ResetLiveboardPersonalisedView
- ResetLiveboardPersonalizedView
- ResetSearch
- ResetSpotterConversation
- Save
- SaveAnswer
- Schedule
- SchedulesList
- Search
- SelectPersonalizedView
- SendTestScheduleEmail
- SetActiveTab
- SetHiddenTabs
- SetVisibleTabs
- SetVisibleVizs
- Share
- ShareSpotterConversation
- ShowUnderlyingData
- SpotIQAnalyze
- SpotterSearch
- SpotterVizSendUserMessage
- StartNewSpotterConversation
- SyncToOtherApps
- SyncToSheets
- TransformTableVizData
- UnpinSpotterConversation
- UpdateCrossFilter
- UpdateFilters
- UpdateParameters
- UpdatePersonalisedView
- UpdatePersonalizedView
- UpdateRuntimeFilters
- UpdateTML
- UpdateTheme
- getExportRequestForCurrentPinboard
Event types that can be triggered by the host application to the embedded ThoughtSpot app.
To trigger an event use the corresponding LiveboardEmbed.trigger or AppEmbed.trigger or SearchEmbed.trigger method.
If using React components to embed, use the format shown in this example:
const selectVizs = () => {
embedRef.current.trigger(HostEvent.SetVisibleVizs, [
"715e4613-c891-4884-be44-aa8d13701c06",
"3f84d633-e325-44b2-be25-c6650e5a49cf"
]);
};
You can also attach an Embed event to a Host event to trigger a specific action as shown in this example:
const EmbeddedComponent = () => {
const embedRef = useRef(null); // import { useRef } from react
const onLiveboardRendered = () => {
embedRef.current.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
};
return (
<LiveboardEmbed
ref={embedRef}
liveboardId="<liveboard-guid>"
onLiveboardRendered={onLiveboardRendered}
/>
);
}
Context Parameter (SDK: 1.45.2+)
Starting from SDK version 1.45.2 | ThoughtSpot: 26.3.0.cl, you can optionally pass a
ContextType as the third parameter to the trigger method to specify the context
from which the event is triggered. This helps ThoughtSpot understand the current page
context (Search, Answer, Liveboard, or Spotter) for better event handling.
import { HostEvent, ContextType } from '@thoughtspot/visual-embed-sdk';
// Trigger Pin event with Search context
appEmbed.trigger(HostEvent.Pin, {
vizId: "123",
liveboardId: "456"
}, ContextType.Search);
Index🔗
Enumeration members🔗
AIHighlights🔗
AIHighlights:= "AIHighlights"
Version : SDK: 1.44.0 | ThoughtSpot: 10.15.0.cl Trigger the AI Highlights action on an embedded Liveboard
Payload: none.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.AIHighlights)
AddColumns🔗
AddColumns:= "addColumns"
Version : SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
Add columns to the current search query.
Payload: { columnIds: string[] }.
Defined in : types.ts
searchEmbed.trigger(HostEvent.AddColumns, { columnIds: ['<column-GUID>','<column-GUID>'] })
// Add columns from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
searchEmbed.trigger(HostEvent.AddColumns, {
columnIds: ['col-guid-1', 'col-guid-2']
}, ContextType.Search);
AddToCoaching🔗
AddToCoaching:= "addToCoaching"
Version : SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl Opens the Add to Coaching modal from a visualization in Spotter Embed.
Defined in : types.ts
- Parameter
-
`vizId ` refers to the Visualization ID in Spotter embed and is required.
spotterEmbed.trigger(HostEvent.AddToCoaching, { vizId: '730496d6-6903-4601-937e-2c691821af3c' });
AnswerChartSwitcher🔗
AnswerChartSwitcher:= "answerChartSwitcher"
Version : SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl Toggle the visualization to chart or table view. Payload: RequiredVizRequest.
Defined in : types.ts
- Parameter
-
`vizId ` refers to the Visualization ID in Spotter embed and is required.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
AskSage🔗
AskSage:= "AskSage"
Version : SDK: 1.29.0 | ThoughtSpot Cloud: 9.12.0.cl Trigger the Ask Sage action for visualizations Payload: RequiredVizRequest.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.AskSage,
{vizId:'730496d6-6903-4601-937e-2c691821af3c'})
AskSpotter🔗
AskSpotter:= "AskSpotter"
Version : SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl Trigger the Spotter action for visualizations present on the liveboard’s vizzes. Payload: RequiredVizRequest.
Defined in : types.ts
- Parameter
-
vizIdrefers to the Visualization ID in Spotter embed and is required.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
CloseSpotterShareConversation🔗
CloseSpotterShareConversation:= "CloseSpotterShareConversation"
Version : SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl Closes the Spotter share-conversation modal. No-op if none is open. Payload: none.
Defined in : types.ts
spotterEmbed.trigger(HostEvent.CloseSpotterShareConversation);
CloseSpotterVizPanel🔗
CloseSpotterVizPanel:= "CloseSpotterVizPanel"
Version : SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl Closes the SpotterViz panel. Payload: none.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.CloseSpotterVizPanel);
CopyLink🔗
CopyLink:= "embedDocument"
Version : SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw Trigger the Copy link action on a Liveboard or visualization Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
object - to trigger the action for a specific visualization in Liveboard embed, pass in
vizIdas a key
liveboardEmbed.trigger(HostEvent.CopyLink)
liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
vizEmbed.trigger(HostEvent.CopyLink)
// Copy link from liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.CopyLink, {}, ContextType.Liveboard);
// Copy link from liveboard visualization context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.CopyLink, {
vizId: '730496d6-6903-4601-937e-2c691821af3c'
}, ContextType.Liveboard);
// Copy link from liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.CopyLink, {}, ContextType.Liveboard);
// Copy link from liveboard visualization context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.CopyLink, {
vizId: '730496d6-6903-4601-937e-2c691821af3c'
}, ContextType.Liveboard);
CreateMonitor🔗
CreateMonitor:= "createMonitor"
Version : SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw Trigger the Create alert action on a KPI chart in a Liveboard or saved Answer. Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
an object with
vizIdas a key
liveboardEmbed.trigger(HostEvent.CreateMonitor, {
vizId: '730496d6-6903-4601-937e-2c691821af3c'
})
searchEmbed.trigger(HostEvent.CreateMonitor)
// Create monitor from answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.CreateMonitor, {}, ContextType.Answer);
// Create monitor from liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.CreateMonitor, {
vizId: '730496d6-6903-4601-937e-2c691821af3c'
}, ContextType.Liveboard);
DataModelInstructions🔗
DataModelInstructions:= "DataModelInstructions"
Version : SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl Opens the data model instructions modal in Spotter Embed.
Defined in : types.ts
spotterEmbed.trigger(HostEvent.DataModelInstructions);
Delete🔗
Delete:= "onDeleteAnswer"
Version : SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw Trigger the Delete action for a visualization in an embedded Liveboard, or a chart or table generated from Search. Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
Liveboard embed takes an object with
vizIdas a key. Can be left empty if embedding Search or visualization.
liveboardEmbed.trigger(HostEvent.Delete, {vizId:
'730496d6-6903-4601-937e-2c691821af3c'})
searchEmbed.trigger(HostEvent.Delete)
// Delete from liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.Delete, {}, ContextType.Liveboard);
// Delete from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.Delete, {}, ContextType.Search);
DeleteLastPrompt🔗
DeleteLastPrompt:= "DeleteLastPrompt"
Version : SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl Deletes the last prompt in spotter embed. Payload: none.
Defined in : types.ts
spotterEmbed.trigger(HostEvent.DeleteLastPrompt);
DestroyEmbed🔗
DestroyEmbed:= "EmbedDestroyed"
Version : SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl Notifies the embedded ThoughtSpot app that the embed is being torn down, so that it can release any resources it holds before the iframe is removed from the DOM.
This is triggered for you by embed.destroy(); you rarely need to trigger it
directly. If waitForCleanupOnDestroy is set in the embed config, destroy()
waits for the app to acknowledge this event (up to cleanupTimeout) before
removing the iframe.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.DestroyEmbed);
Download🔗
Download:= "downloadAsPng"
Trigger the Download action on charts in the embedded view. Use HostEvent.DownloadAsPng instead.
Deprecated : from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
Version : SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
Defined in : types.ts
- Parameter
-
vizIdrefers to the Visualization ID in Spotter embed and is required in Spotter embed.
liveboardEmbed.trigger(HostEvent.Download, {vizId:
'730496d6-6903-4601-937e-2c691821af3c'})
embed.trigger(HostEvent.Download)
// You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
DownloadAsCsv🔗
DownloadAsCsv:= "downloadAsCSV"
Version : SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw Trigger the Download > CSV action on tables in the embedded view. Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
vizIdrefers to the Visualization ID in Spotter embed and is required in Spotter embed.
liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
'730496d6-6903-4601-937e-2c691821af3c'})
vizEmbed.trigger(HostEvent.DownloadAsCsv)
searchEmbed.trigger(HostEvent.DownloadAsCsv)
// You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
// Download as CSV from search-answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.DownloadAsCsv, {}, ContextType.Search);
// Download as CSV from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
searchEmbed.trigger(HostEvent.DownloadAsCsv, {}, ContextType.Search);
DownloadAsPdf🔗
DownloadAsPdf:= "downloadAsPdf"
Version : SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw Trigger the Download PDF action on an embedded Liveboard, visualization or Answer.
Payload: VizScopedRequest plus optional liveboardId.
Defined in : types.ts
- Parameter
-
vizIdrefers to the Answer ID in Spotter embed and is required in Spotter embed.
NOTE: The Download > PDF action is available on visualizations and Answers if the data is in tabular format.
liveboardEmbed.trigger(HostEvent.DownloadAsPdf)
// You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
// Download as PDF from search-answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.DownloadAsPdf, {}, ContextType.Search);
// Download as PDF from liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.DownloadAsPdf, {}, ContextType.Liveboard);
DownloadAsPng🔗
DownloadAsPng:= "downloadAsPng"
Version : SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw Trigger the Download > PNG action on charts in the embedded view. Payload: VizScopedRequest.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.DownloadAsPng,
{vizId:'730496d6-6903-4601-937e-2c691821af3c'})
vizEmbed.trigger(HostEvent.DownloadAsPng)
searchEmbed.trigger(HostEvent.DownloadAsPng)
// You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
// Download as PNG from search-answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.DownloadAsPng, {}, ContextType.Search);
DownloadAsXlsx🔗
DownloadAsXlsx:= "downloadAsXLSX"
Version : SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw Trigger the Download > XLSX action on tables in the embedded view. Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
vizIdrefers to the Visualization ID in Spotter embed and is required in Spotter embed.
liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
'730496d6-6903-4601-937e-2c691821af3c'})
vizEmbed.trigger(HostEvent.DownloadAsXlsx)
searchEmbed.trigger(HostEvent.DownloadAsXlsx)
// You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
let latestSpotterVizId = '';
spotterEmbed.on(EmbedEvent.Data, (payload) => {
latestSpotterVizId = payload.data.id;
});
spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
// Download as XLSX from answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.DownloadAsXlsx, {}, ContextType.Answer);
// Download as XLSX from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
searchEmbed.trigger(HostEvent.DownloadAsXlsx, {}, ContextType.Search);
DownloadLiveboardAsContinuousPDF🔗
DownloadLiveboardAsContinuousPDF:= "downloadLiveboardAsContinuousPDF"
Version : SDK: 1.48.0 | ThoughtSpot: 26.5.0.cl Trigger the Download Liveboard as Continuous PDF action on an embedded Liveboard.
Defined in : types.ts
liveboardEmbed.trigger(HostEvent.DownloadLiveboardAsContinuousPDF)
DrillDown🔗
DrillDown:= "triggerDrillDown"
Version : SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1 Triggers a drill on certain points of the specified column Payload: DrillDownRequest; in Liveboard context vizId is required (RequiredVizRequest). trigger() accepts the union now; per-context enforced next release. Includes the following properties:
Defined in : types.ts
- Parameter
-
Includes the following keys:
-
points: An object containingselectedPointsand/orclickedPointto drill to. For example,{ selectedPoints: [] }. -
columnGuid: Optional. GUID of the column to drill by. If not provided, it will auto drill by the configured column. -
autoDrillDown: Optional. Iftrue, the drill down will be done automatically on the most popular column. -
vizId(TS >= 9.8.0): Optional. The GUID of the visualization to drill in case of a Liveboard. In Spotter embed,vizIdrefers to the Answer ID and is required.
-
searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
console.log(payload);
const clickedPoint = payload.data.clickedPoint;
const selectedPoint = payload.data.selectedPoints;
console.log('>>> called', clickedPoint);
searchEmbed.trigger(HostEvent.DrillDown, {
points: {
clickedPoint,
selectedPoints: selectedPoint
},
autoDrillDown: true,
});
})
// Works with TS 9.8.0 and above
liveboardEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
console.log(payload);
const clickedPoint = payload.data.clickedPoint;
const selectedPoint = payload.data.selectedPoints;
console.log('>>> called', clickedPoint);
liveboardEmbed.trigger(HostEvent.DrillDown, {
points: {
clickedPoint,
selectedPoints: selectedPoint
},
columnGuid: "<guid of the column to drill>",
vizId: payload.data.vizId
});
})
// Drill down from answer context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.DrillDown, {
points: { clickedPoint, selectedPoints },
autoDrillDown: true
}, ContextType.Answer);
// Drill down from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
searchEmbed.trigger(HostEvent.DrillDown, {
points: { clickedPoint, selectedPoints },
columnGuid: "column-guid"
}, ContextType.Search);
Edit🔗
Edit:= "edit"
Version : SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw Trigger the Edit action on a Liveboard or a visualization on a Liveboard.
This event is not supported in visualization embed and search embed. Payload: VizScopedRequest.
Defined in : types.ts
- Parameter
-
Object parameter. Includes the following keys:
-
vizId: To trigger the action for a specific visualization in Liveboard embed, pass invizIdas a key. In Spotter embed,vizIdrefers to the Answer ID and is required.
-
liveboardEmbed.trigger(HostEvent.Edit)
liveboardEmbed.trigger(HostEvent.Edit, {vizId:
'730496d6-6903-4601-937e-2c691821af3c'})
spotterEmbed.trigger(HostEvent.Edit);
// Using context parameter to edit liveboard context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
liveboardEmbed.trigger(HostEvent.Edit, {}, ContextType.Liveboard);
// Edit from search context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.Edit, {}, ContextType.Search);
-
@example
// Edit from spotter context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
appEmbed.trigger(HostEvent.Edit, {
vizId: '730496d6-6903-4601-937e-2c691821af3c'
}, ContextType.Spotter);
EditLastPrompt🔗
EditLastPrompt:= "EditLastPrompt"
Version : SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
Edits the last prompt in spotter embed.
Payload: string.
Defined in : types.ts
- Parameter
-
query: Text string
spotterEmbed.trigger(HostEvent.EditLastPrompt, "revenue per year");
// Edit last prompt from spotter context
import { ContextType } from '@thoughtspot/visual-embed-sdk';
spotterEmbed.trigger(HostEvent.EditLastPrompt, "sales by region", ContextType.Spotter);