Embedded Intelligence SDK
The AlphaSense Embedded Intelligence SDK allows you to seamlessly integrate AlphaSense's powerful widgets into your web applications. Embed document viewers, generative search capabilities, and other intelligence features directly into your platform.
Overview
The Embedded Intelligence SDK provides a collection of interactive widgets that can be easily integrated into any web application. These widgets leverage AlphaSense's comprehensive data and AI capabilities to deliver intelligent insights directly within your applications.
Available Widgets
- Company Summary - View comprehensive company information
- Company Topics - Company-related topics and themes
- Document List - Browse and select documents from collections
- Smart Summary - Generate intelligent document summaries
- Document Viewer - Display and interact with specific documents
- Generative Search - AI-powered chat interface for searching and analyzing content
Quick Start
Installation
Install the SDK using npm:
npm install @alphasense/embedded-widgets
Or use via CDN:
<script src="https://unpkg.com/@alphasense/embedded-widgets@latest/dist/index.min.js"></script>
Basic Usage
import {AlphaSenseWidget} from '@alphasense/embedded-widgets'
const widget = new AlphaSenseWidget({
target: '#widget-container',
widgetType: 'companySummary',
companyParams: {
tickerCode: 'AAPL',
},
width: '100%',
height: '500px',
}).init()
CDN Example
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AlphaSense Widget</title>
</head>
<body>
<div class="container">
<div id="widget"></div>
</div>
<script src="https://unpkg.com/@alphasense/embedded-widgets@latest/dist/index.min.js"></script>
<script>
new AlphaSenseWidget({
target: '#widget',
widgetType: 'companySummary',
companyParams: {
tickerCode: 'AAPL',
},
width: '300px',
height: '500px',
}).init()
</script>
</body>
</html>
Configuration Options
When initializing the AlphaSenseWidget, you can pass the following options:
| Option | Type | Required | Description |
|---|---|---|---|
target | string | HTMLElement | No | The target element to render the widget into. Can be a CSS selector string or an HTMLElement. If not provided, a default container will be created. |
widgetType | WidgetType | Yes | The type of widget to render. Available values: 'companySummary', 'companyTopics', 'documentList', 'smartSummary', 'documentViewer', 'generativeSearch' |
widgetUrl | string | No | Custom widget backend URL |
generativeSearchParams | object | No | Parameters specific to the Generative Search widget. |
documentViewerParams | object | No | Parameters specific to the Document Viewer widget. Required when widgetType is 'documentViewer'. |
onDocumentClick | function | No | Callback that is called when a document is clicked (e.g., an item in DocumentList, a citation in GenerativeSearch, or a citation in CompanyTopics). Receives the document ID as a parameter. When provided, automatically sets documentClickMode to 'docviewer'. |
companyParams | object | No | Parameters specific to the target company identification. See below for details. |
documentSearchParams | object | No | Parameters for filtering and searching documents in the Document List widget. See "Document List with Search Parameters" section for details. |
documentClickMode | string | No | Navigation mode for document click handling. Possible values: 'platform' (default), 'docviewer', 'popup'. |
width | string | No | The width of the widget. Defaults to '100%'. |
height | string | No | The height of the widget. Defaults to '100%'. |
generativeSearchParams
The generativeSearchParams object is optional when using the Generative Search widget:
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationId | string | No | The conversation ID to continue an existing conversation (e.g., '1234567890__987654321'). |
initialPrompt | string | No | The initial prompt to start a new conversation with (e.g., 'What are the latest Intel results?'). Note: This parameter is ignored when conversationId is provided, as it only works with new conversations. |
documentViewerParams
The documentViewerParams object is required when using the Document Viewer widget:
| Parameter | Type | Required | Description |
|---|---|---|---|
docId | string | Yes | The document ID to display in the viewer (e.g., 'doc-12345'). |
companyParams
The companyParams object can include the following properties:
| Parameter | Type | Description |
|---|---|---|
tickerCode | string | The ticker code for the company (e.g., 'AAPL', 'NVDA', 'TSLA'). |
Widget Types
The SDK supports the following widget types:
companySummary- Company overview and key metricscompanyTopics- Company-related topics and themesdocumentList- Searchable document collectionsdocumentViewer- Individual document displaysmartSummary- AI-generated document summariesgenerativeSearch- Interactive AI search interface
Practical Examples
Document List with Document Viewer Integration
// Document List widget provides onDocumentClick callback
const documentList = new AlphaSenseWidget({
target: '#document-list',
widgetType: 'documentList',
companyParams: {
tickerCode: 'AAPL',
},
onDocumentClick: docId => {
console.log('Document clicked:', docId)
updateDocumentViewer(docId) // Custom handler function
},
width: '300px',
height: '500px',
}).init()
Document List with Search Parameters
The Document List widget supports advanced filtering and search capabilities through documentSearchParams:
// Single company with search filters
new AlphaSenseWidget({
target: '#document-list',
widgetType: 'documentList',
companyParams: {
tickerCode: 'AAPL',
},
documentSearchParams: {
keyword: 'earnings',
documentTypes: ['1', '2'],
primaryOnly: true,
sorting: {
field: 'DATE',
direction: 'DESC',
},
},
width: '100%',
height: '600px',
}).init()
// Multi-company search
new AlphaSenseWidget({
target: '#document-list',
widgetType: 'documentList',
documentSearchParams: {
tickers: ['MSFT', 'AAPL', 'GOOGL'],
keyword: 'revenue',
contentSetIds: ['12001', '77'],
sorting: {
field: 'RELEVANCE',
direction: 'DESC',
},
},
width: '100%',
height: '600px',
}).init()
// Watchlist-based filtering
new AlphaSenseWidget({
target: '#document-list',
widgetType: 'documentList',
documentSearchParams: {
watchlistIds: ['1367044'],
keyword: 'AI trends',
sorting: {
field: 'DATE',
direction: 'DESC',
},
},
width: '100%',
height: '600px',
}).init()
Available Search Parameters
| Parameter | Type | Description |
|---|---|---|
keyword | string | Text search keyword to filter documents |
documentTypes | string[] | Array of document type IDs for filtering |
savedSearchId | string | Saved search ID to load predefined search criteria |
watchlistIds | string[] | Array of watchlist IDs to filter documents by watchlists |
contentSetIds | string[] | Array of content set IDs to filter by document sources |
tickers | string[] | Array of ticker codes to filter documents by multiple companies |
sorting | object | Sort configuration with field ('DATE', 'RELEVANCE', 'SENTIMENT', 'PAGES') and direction ('ASC', 'DESC') |
primaryOnly | boolean | If true, only show documents where the company is the primary subject (not just mentioned) |
Company Topics with Document Viewer Integration
The Company Topics widget supports onDocumentClick callback for handling citation clicks:
// Company Topics widget with citation click handling
const companyTopics = new AlphaSenseWidget({
target: '#company-topics',
widgetType: 'companyTopics',
companyParams: {
tickerCode: 'AAPL',
},
onDocumentClick: docId => {
console.log('Citation clicked in Company Topics:', docId)
updateDocumentViewer(docId) // Custom handler function
},
width: '100%',
height: '450px',
}).init()
Generative Search Examples
Starting a new conversation with an initial prompt:
new AlphaSenseWidget({
target: '#generative-search',
widgetType: 'generativeSearch',
generativeSearchParams: {
initialPrompt: 'What are the latest Intel results?',
},
width: '100%',
height: '600px',
}).init()
Continuing an existing conversation:
new AlphaSenseWidget({
target: '#generative-search',
widgetType: 'generativeSearch',
generativeSearchParams: {
conversationId: '1234567890__987654321',
},
width: '100%',
height: '600px',
}).init()
Next Steps
- Document Viewer Guide - Learn how to embed document viewing capabilities
- Generative Search Guide - Integrate AI-powered search functionality
- Widget Integration Patterns - Best practices for combining multiple widgets
Support
For technical support and questions about the Embedded Intelligence SDK, please contact apisupport@alpha-sense.com.