FastComments.com

FastComments JavaScript/TypeScript SDK

This is the official JavaScript/TypeScript SDK for FastComments.

Official JavaScript/TypeScript SDK for the FastComments API

Repository

View on GitHub

Installation Internal Link

npm install fastcomments-sdk

API Documentation Internal Link

Full API reference: docs/api/README.md

Browser vs Server Compatibility Internal Link

This SDK uses dual entry points to ensure optimal compatibility and prevent runtime errors:

  • fastcomments-sdk/browser - Browser-safe version with native fetch
  • fastcomments-sdk/server - Full Node.js version with SSO support
  • fastcomments-sdk (default) - Types only, safe to import anywhere

Public vs Secured APIs Internal Link

The SDK provides three main API classes:

  • DefaultApi - Secured endpoints that require your API key for authentication. Use these for server-side operations.
  • PublicApi - Public endpoints that can be accessed without an API key. These can be called directly from browsers/mobile devices/etc.
  • HiddenApi - Internal/admin endpoints for advanced use cases.

Example: Using Public API (browser-safe)

import { PublicApi } from 'fastcomments-sdk/browser';

const publicApi = new PublicApi();

// Get comments for a page (no API key required)
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

Example: Using Default API (server-side only)

import { DefaultApi, Configuration } from 'fastcomments-sdk/server';

const config = new Configuration({
  apiKey: 'your-api-key' // Keep this secret!
});
const defaultApi = new DefaultApi(config);

// Get comments with full admin access
const response = await defaultApi.getComments({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

SSO (Single Sign-On) Integration Internal Link

FastComments supports SSO to integrate with your existing user authentication system. SSO functionality is only available in the server export since it requires Node.js crypto features.

Simple SSO (Server-Side Only)

Simple SSO should be generated server-side and sent to the client:

// Server-side code (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Create simple SSO using the built-in helper  
const userData = {
  username: 'john_doe',
  email: 'john@example.com',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg'
};

const sso = FastCommentsSSO.createSimple(userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoToken = sso.createToken();

// Send ssoToken to your client-side code
// Client-side code can then use this token with the browser SDK

Secure SSO should be implemented server-side and provides better security:

// Server-side code (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Create secure SSO using the built-in helper
const userData = {
  id: 'user-123',
  email: 'john@example.com',
  username: 'john_doe',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg',
  isAdmin: false,
  isModerator: false
};

const sso = FastCommentsSSO.createSecure('your-api-key', userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoConfig = sso.prepareToSend();

// Use with API calls on the server
const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: JSON.stringify(ssoConfig)
});

// Or send ssoConfig to client for browser usage

Using SSO from Browser (with Server-Generated Token)

// Client-side code (browser)
import { PublicApi } from 'fastcomments-sdk/browser';

// Get SSO token from your server endpoint
const ssoToken = await fetch('/api/sso-token').then(r => r.json());

const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: ssoToken // Use the server-generated SSO token
});

SSO with Comment Creation

// Server-side: Create SSO and comment
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

const sso = FastCommentsSSO.createSecure('your-api-key', userData);
const ssoConfig = sso.prepareToSend();

const response = await publicApi.createCommentPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  broadcastId: 'unique-broadcast-id',
  commentData: {
    comment: 'This is my comment',
    date: Date.now(),
    commenterName: 'John Doe',
    url: 'https://example.com/page',
    urlId: 'page-url-id'
  },
  sso: JSON.stringify(ssoConfig)
});

Common Use Cases Internal Link

Getting Comments for a Page

const comments = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'article-123'
});

Creating a Comment

const newComment = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'article-123',
    comment: 'Great article!',
    commenterName: 'John Doe',
    commenterEmail: 'john@example.com'
  }
});

Voting on a Comment

const voteResponse = await sdk.publicApi.voteComment({
  voteBodyParams: {
    commentId: 'comment-id',
    direction: 1 // 1 for upvote, -1 for downvote
  }
});

User Management (Requires API Key)

// Search for users (requires DefaultApi)
const users = await sdk.defaultApi.searchUsers({
  tenantId: 'your-tenant-id',
  urlId: 'page-id',
  usernameStartsWith: 'john'
});

Live Events (Real-time Updates) Internal Link

Subscribe to live events to get real-time updates for comments, votes, and other activities.

Page-Level Events

Listen for live events on a specific page (comments, votes, etc.):

import { subscribeToChanges, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const config = {
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
};

// Subscribe to live events for a page
const subscription = subscribeToChanges(
  config,
  'your-tenant-id', // tenantIdWS
  'page-url-id',    // urlIdWS  
  'user-session-id', // userIdWS (get this from getComments response)
  (event: LiveEvent) => {
    console.log('Live event received:', event);

    switch (event.type) {
      case LiveEventType.new_comment:
        console.log('New comment:', event.comment);
        // Update your UI with the new comment
        break;
      case LiveEventType.new_vote:
        console.log('New vote:', event.vote);
        // Update vote counts in your UI
        break;
      case LiveEventType.updated_comment:
        console.log('Comment updated:', event.comment);
        break;
      default:
        console.log('Other event type:', event.type);
    }

    return true; // Return true if event was handled
  },
  (isConnected: boolean) => {
    console.log('Connection status:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close the subscription when done
subscription.close();

Subscribe to User Events

Listen for user-specific events (notifications, mentions, etc.):

import { subscribeToUserFeed, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const userConfig = {
  userIdWS: 'user-session-id', // Get this from getComments response
};

// Subscribe to user's personal feed
const userSubscription = subscribeToUserFeed(
  userConfig,
  (event: LiveEvent) => {
    console.log('User event received:', event);

    switch (event.type) {
      case LiveEventType.notification:
        console.log('New notification:', event.notification);
        // Show notification in your UI
        break;
      case LiveEventType.notification_update:
        console.log('Notification updated:', event.notification);
        break;
      default:
        console.log('Other user event:', event.type);
    }

    return true;
  },
  (isConnected: boolean) => {
    console.log('User feed connection:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close when done
userSubscription.close();

Getting userIdWS

The userIdWS parameter is required for live events and can be obtained from API responses:

const response = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-id'
});

// Extract userIdWS from the response
const userIdWS = response.data?.userSessionInfo?.userIdWS;

if (userIdWS) {
  // Now you can subscribe to live events
  const subscription = subscribeToChanges(config, tenantIdWS, urlIdWS, userIdWS, handleEvent);
}

Broadcast IDs Internal Link

You'll see you're supposed to pass a broadcastId in some API calls. When you receive events, you'll get this ID back, so you know to ignore the event if you plan to optimistically apply changes on the client (which you'll probably want to do since it offers the best experience). Pass a UUID here. The ID should be unique enough to not occur twice in a browser session.

import { v4 as uuidv4 } from 'uuid';

const response = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'page-id',
    comment: 'My comment',
    broadcastId: uuidv4() // Unique ID for this operation
  }
});

Error Handling Internal Link

try {
  const comments = await sdk.publicApi.getCommentsPublic({
    tenantId: 'your-tenant-id',
    urlId: 'page-id'
  });
} catch (error) {
  if (error.response?.status === 404) {
    console.log('Page not found');
  } else {
    console.error('API Error:', error.message);
  }
}

TypeScript Support Internal Link

The SDK is written in TypeScript and provides complete type definitions for all API methods and response models:

// Import types from the default export (safe everywhere)
import type { 
  PublicComment, 
  CreateCommentParams, 
  GetCommentsPublic200Response 
} from 'fastcomments-sdk';

// Use with browser SDK
import { createFastCommentsBrowserSDK } from 'fastcomments-sdk/browser';

const sdk = createFastCommentsBrowserSDK();
const response: GetCommentsPublic200Response = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-id'
});

const comments: PublicComment[] = response.comments || [];

aggregate Internal Link

Aggregates documents by grouping them (if groupBy is provided) and applying multiple operations. Different operations (e.g. sum, countDistinct, avg, etc.) are supported.

Parameters

Name Type Required Description
tenantId string Yes
aggregationRequest AggregationRequest Yes
parentTenantId string No
includeStats boolean No

Response

Returns: AggregationResponse

Example

aggregate Example
Copy Copy
1
2const tenantId: string = 'acme_corp_tenant_001';
3const parentTenantId: string = 'acme_global_parent';
4const includeStats: boolean = true;
5const aggregationRequest: AggregationRequest = {
6 predicates: [
7 { field: 'status', operator: 'eq', value: 'published' } as QueryPredicate
8 ],
9 operations: [
10 { opType: 'count', field: 'commentId', alias: 'totalComments' } as AggregationOperation,
11 { opType: 'group_by', field: 'threadId', alias: 'commentsByThread', limit: 10 } as AggregationOperation
12 ],
13 sort: [{ field: 'totalComments', direction: 'desc' }] as AggregationRequestSort[],
14 limit: 100
15};
16const result: AggregationResponse = await aggregate(tenantId, aggregationRequest, parentTenantId, includeStats);
17

getAuditLogs Internal Link

Parameters

Name Type Required Description
tenantId string Yes
limit number No
skip number No
order SORTDIR No
after number No
before number No

Response

Returns: GetAuditLogs200Response

Example

getAuditLogs Example
Copy Copy
1
2const tenantId: string = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
3const limit: number = 100;
4const skip: number = 0;
5const order: SORTDIR = ("DESC" as unknown) as SORTDIR;
6const after: number = Date.now() - 1000 * 60 * 60 * 24 * 30; // 30 days ago
7const before: number = Date.now();
8const result: GetAuditLogs200Response = await getAuditLogs(tenantId, limit, skip, order, after, before);
9

blockFromCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: BlockFromCommentPublic200Response

Example

blockFromCommentPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_8f4b2a';
3const commentId: string = 'cmt_92a7f1';
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: 'Repeated phishing links',
6 durationHours: 168,
7 blockUser: true
8} as PublicBlockFromCommentParams;
9const ssoToken: string = 'sso:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
10const response: BlockFromCommentPublic200Response = await blockFromCommentPublic(tenantId, commentId, publicBlockFromCommentParams, ssoToken);
11

unBlockCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: UnBlockCommentPublic200Response

Example

unBlockCommentPublic Example
Copy Copy
1
2const tenantId: string = "tenant_acme_42";
3const commentId: string = "cmt_7d1f3e9b";
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: "false positive moderation",
6 moderatorId: "mod-47",
7 reviewedAt: "2025-11-04T10:15:00Z"
8};
9const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
10
11const result: UnBlockCommentPublic200Response = await unBlockCommentPublic(
12 tenantId,
13 commentId,
14 publicBlockFromCommentParams,
15 sso
16);
17

checkedCommentsForBlocked Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentIds string Yes
sso string No

Response

Returns: CheckedCommentsForBlocked200Response

Example

checkedCommentsForBlocked Example
Copy Copy
1
2const tenantId: string = "tenant_prod_84a2";
3const commentIds: string = "cmt-112233,cmt-445566";
4const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso.signature";
5
6const resultWithoutSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds);
7const resultWithSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds, ssoToken);
8

blockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
blockFromCommentParams BlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: BlockFromCommentPublic200Response

Example

blockUserFromComment Example
Copy Copy
1
2const tenantId: string = 'tenant_5f8b9a2c';
3const id: string = 'cmt_0123456789abcdef';
4const blockFromCommentParams: BlockFromCommentParams = {
5 reason: 'Repeated abusive language',
6 durationHours: 72,
7 notifyModerators: true,
8 applyToThread: false
9};
10const userId: string | undefined = 'user_42';
11const anonUserId: string | undefined = undefined;
12const response: BlockFromCommentPublic200Response = await blockUserFromComment(tenantId, id, blockFromCommentParams, userId, anonUserId);
13

createCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
broadcastId string Yes
commentData CommentData Yes
sessionId string No
sso string No

Response

Returns: CreateCommentPublic200Response

Example

createCommentPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_prod_us_east_01';
3const urlId: string = 'news-site/article/2025/11/04/12345';
4const broadcastId: string = 'broadcast_live_20251104_01';
5const commentData: CommentData = {
6 text: 'Excellent analysis — the timeline and sources clarified a lot. Curious about next steps for the investigation.',
7 authorName: 'Jordan Miles',
8 authorAvatarUrl: 'https://cdn.example.com/avatars/jordan.jpg',
9 mentions: [{ userId: 'user_10234', displayName: 'Alex R.' }],
10 metadata: { region: 'us-east', contentType: 'comment' }
11};
12const sessionId: string = 'sess_ab12cd34ef';
13const sso: string = 'sso_token_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
14const result: CreateCommentPublic200Response = await createCommentPublic(tenantId, urlId, broadcastId, commentData, sessionId, sso);
15

deleteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
contextUserId string No
isLive boolean No

Response

Returns: DeleteComment200Response

Example

deleteComment Example
Copy Copy
1
2const tenantId: string = 'f47ac10b-58cc-4372-a567-0e02b2c3d479';
3const commentId: string = 'a1b2c3d4-e5f6-47b8-9c0d-123456789abc';
4const contextUserId: string = '9f8e7d6c-5b4a-3210-fedc-ba9876543210';
5const result: DeleteComment200Response = await deleteComment(tenantId, commentId, contextUserId, true);
6

deleteCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
editKey string No
sso string No

Response

Returns: DeleteCommentPublic200Response

Example

deleteCommentPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_42';
3const commentId: string = 'cmt_7f3b2a1e';
4const broadcastId: string = 'broadcast_homepage_en-us';
5const editKey: string | undefined = 'edit_9a8b7c6d';
6const sso: string | undefined = 'sso_jwt_eyJhbGciOiJIUzI1Ni';
7const response: DeleteCommentPublic200Response = await deleteCommentPublic(tenantId, commentId, broadcastId, editKey, sso);
8

deleteCommentVote Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
voteId string Yes
urlId string Yes
broadcastId string Yes
editKey string No
sso string No

Response

Returns: DeleteCommentVote200Response

Example

deleteCommentVote Example
Copy Copy
1
2const tenantId: string = "tenant_9f2a3b";
3const commentId: string = "cmt-8f3a2b";
4const voteId: string = "vot-20251104-01";
5const urlId: string = "article-2025-11-04-homepage";
6const broadcastId: string = "live-embed-01";
7const editKey: string = "edk-6a7b8c9d"; // optional
8const sso: string | undefined = undefined; // optional, omitted in this call
9
10const result: DeleteCommentVote200Response = await deleteCommentVote(
11 tenantId,
12 commentId,
13 voteId,
14 urlId,
15 broadcastId,
16 editKey,
17 sso
18);
19

flagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment200Response

Example

flagComment Example
Copy Copy
1
2const tenantId: string = 'tenant_8a3b2c1d';
3const commentId: string = 'cmt_5f7e3a9b';
4const userId: string | undefined = 'user_42f1a';
5const anonUserId: string | undefined = 'anon_e2c3f1';
6const result: FlagComment200Response = await flagComment(tenantId, commentId, userId, anonUserId);
7

getComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetComment200Response

Example

getComment Example
Copy Copy
1
2const tenantId: string = 'org-534ac2';
3const commentId: string = 'cmt-9d7f2b44-1a2b-4c3d-9e8f-123456789abc';
4const requestedFields: PickFCommentAPICommentFieldsKeys[] | undefined = ['body', 'user']; // optional selection
5const result: GetComment200Response = await getComment(tenantId, commentId);
6

getComments Internal Link

Parameters

Name Type Required Description
tenantId string Yes
page number No
limit number No
skip number No
asTree boolean No
skipChildren number No
limitChildren number No
maxTreeDepth number No
urlId string No
userId string No
anonUserId string No
contextUserId string No
hashTag string No
parentId string No
direction SortDirections No

Response

Returns: GetComments200Response

Example

getComments Example
Copy Copy
1
2const tenantId: string = "fc_tenant_79b";
3const page: number = 2;
4const limit: number = 50;
5const skip: number = 0;
6const asTree: boolean = true;
7const maxTreeDepth: number = 3;
8const urlId: string = "https://example.com/articles/performance-tips";
9const userId: string = "user_42";
10const anonUserId: string = "anon_7a9";
11const direction: SortDirections = ("desc" as unknown) as SortDirections;
12const response: GetComments200Response = await getComments(
13 tenantId,
14 page,
15 limit,
16 skip,
17 asTree,
18 undefined,
19 undefined,
20 maxTreeDepth,
21 urlId,
22 userId,
23 anonUserId,
24 undefined,
25 "release-2025",
26 undefined,
27 direction
28);
29

getCommentsPublic Internal Link

req tenantId urlId

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
page number No
direction SortDirections No
sso string No
skip number No
skipChildren number No
limit number No
limitChildren number No
countChildren boolean No
fetchPageForCommentId string No
includeConfig boolean No
countAll boolean No
includei10n boolean No
locale string No
modules string No
isCrawler boolean No
includeNotificationCount boolean No
asTree boolean No
maxTreeDepth number No
useFullTranslationIds boolean No
parentId string No
searchText string No
hashTags Array No
userId string No
customConfigStr string No
afterCommentId string No
beforeCommentId string No

Response

Returns: GetCommentsPublic200Response

Example

getCommentsPublic Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const urlId: string = 'blog/2025/launch-announcement';
4const page: number = 1;
5const direction: SortDirections = ('desc' as unknown) as SortDirections;
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
7const limit: number = 25;
8const limitChildren: number = 5;
9const countChildren: boolean = true;
10const includeConfig: boolean = true;
11const asTree: boolean = true;
12const maxTreeDepth: number = 3;
13const searchText: string = 'performance improvements';
14const hashTags: Array<string> = ['release', 'performance'];
15const userId: string = 'user_8421';
16
17const response: GetCommentsPublic200Response = await getCommentsPublic(
18 tenantId,
19 urlId,
20 page,
21 direction,
22 sso,
23 undefined,
24 undefined,
25 limit,
26 limitChildren,
27 countChildren,
28 undefined,
29 includeConfig,
30 undefined,
31 undefined,
32 undefined,
33 undefined,
34 undefined,
35 undefined,
36 asTree,
37 maxTreeDepth,
38 undefined,
39 undefined,
40 searchText,
41 hashTags,
42 userId,
43 undefined,
44 undefined,
45 undefined
46);
47

getCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
editKey string No
sso string No

Response

Returns: GetCommentText200Response

Example

getCommentText Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "acme-publishing-42";
4 const commentId: string = "cmt_20251104_9f3b2a";
5 const responseWithoutEdit: GetCommentText200Response = await getCommentText(tenantId, commentId);
6 const editKey: string = "edK_7b2f9a";
7 const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
8 const responseWithEditAndSSO: GetCommentText200Response = await getCommentText(tenantId, commentId, editKey, sso);
9 console.log(responseWithoutEdit, responseWithEditAndSSO);
10})();
11

getCommentVoteUserNames Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
dir number Yes
sso string No

Response

Returns: GetCommentVoteUserNames200Response

Example

getCommentVoteUserNames Example
Copy Copy
1
2const tenantId: string = "f7a8b9c0-1234-5678-90ab-cdef12345678";
3const commentId: string = "d3b07384-d9f1-4c2b-9f2e-8a7c6f1e2b9a";
4const dir: number = 1;
5const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fake.payload";
6const resultWithoutSSO: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir);
7const resultWithSSO: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir, ssoToken);
8

lockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment200Response

Example

lockComment Example
Copy Copy
1
2const tenantId: string = 'tenant_4f2b3c1a';
3const commentId: string = 'cmt_5d21a9f3';
4const broadcastId: string = 'broadcast_newsroom_2025-11-04';
5
6const resultWithoutSSO: LockComment200Response = await lockComment(tenantId, commentId, broadcastId);
7
8const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiaWF0IjoxNjM0ODAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
9const resultWithSSO: LockComment200Response = await lockComment(tenantId, commentId, broadcastId, ssoToken);
10

pinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment200Response

Example

pinComment Example
Copy Copy
1
2const tenantId: string = 'news-site-42';
3const commentId: string = 'c7a8b9f2-3d5b-4e6f-9a1b-2c3d4e5f6a7b';
4const broadcastId: string = 'live-sports-2025-11-04-nyc';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
6
7const pinned: PinComment200Response = await pinComment(tenantId, commentId, broadcastId);
8const pinnedWithSso: PinComment200Response = await pinComment(tenantId, commentId, broadcastId, ssoToken);
9

saveComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createCommentParams CreateCommentParams Yes
isLive boolean No
doSpamCheck boolean No
sendEmails boolean No
populateNotifications boolean No

Response

Returns: SaveComment200Response

Example

saveComment Example
Copy Copy
1
2const tenantId: string = 'tenant_9b4c1f';
3const createCommentParams: CreateCommentParams = ({
4 content: 'I enjoyed this article — the examples were very helpful.',
5 authorName: 'Jamie R.',
6 authorEmail: 'jamie.r@example.com',
7 parentId: null,
8 metadata: { articleId: 'art_4521', section: 'comments' }
9} as CreateCommentParams);
10const result: SaveComment200Response = await saveComment(tenantId, createCommentParams, true, true, false, true);
11

saveCommentsBulk Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createCommentParams Array Yes
isLive boolean No
doSpamCheck boolean No
sendEmails boolean No
populateNotifications boolean No

Response

Returns: Array<SaveComment200Response

Example

saveCommentsBulk Example
Copy Copy
1
2const tenantId: string = "tenant_acme_7649";
3const createCommentParams: Array<CreateCommentParams> = [
4 {
5 threadId: "article-2025-cloud-costs",
6 text: "Great breakdown — saved me hours. Note: reserved instance math seems off for multi-AZ.",
7 authorName: "Jordan Lee",
8 authorEmail: "jordan.lee@acme.co",
9 createdAt: "2025-11-04T10:15:00Z",
10 mentions: [{ userId: "u_12345", username: "samuel.t" }],
11 hashtags: [{ tag: "cloud-costs" }]
12 },
13 {
14 threadId: "product-release-q4",
15 text: "Congrats team! I left a couple UX notes in the doc linked below.",
16 authorName: "Priya Nair",
17 authorEmail: "priya@startup.io",
18 parentId: "c_98765",
19 mentions: [{ userId: "u_67890", username: "devops" }],
20 hashtags: [{ tag: "release" }]
21 }
22];
23const isLive: boolean = true;
24const doSpamCheck: boolean = true;
25const sendEmails: boolean = false;
26const populateNotifications: boolean = true;
27const responses: Array<SaveComment200Response> = await saveCommentsBulk(tenantId, createCommentParams, isLive, doSpamCheck, sendEmails, populateNotifications);
28

setCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
commentTextUpdateRequest CommentTextUpdateRequest Yes
editKey string No
sso string No

Response

Returns: SetCommentText200Response

Example

setCommentText Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_corp';
3const commentId: string = 'cmt-987654321';
4const broadcastId: string = 'article-2025-11-04-hero';
5const commentTextUpdateRequest: CommentTextUpdateRequest = {
6 text: 'Thanks — I updated this with a correction and a follow-up question for clarity.',
7 mentions: [{ userId: 'usr_102', displayName: 'Ava Lee' } as CommentUserMentionInfo],
8 hashtags: [{ tag: 'policy', startIndex: 68 } as CommentUserHashTagInfo]
9};
10const editKey: string = 'editKey_7f4d2';
11const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
12const result: SetCommentText200Response = await setCommentText(
13 tenantId,
14 commentId,
15 broadcastId,
16 commentTextUpdateRequest,
17 editKey,
18 sso
19);
20

unBlockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
unBlockFromCommentParams UnBlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: UnBlockCommentPublic200Response

Example

unBlockUserFromComment Example
Copy Copy
1
2const tenantId: string = 'tenant-prod-51';
3const id: string = 'cmt_20251104_0001';
4const unBlockFromCommentParams: UnBlockFromCommentParams = {
5 reason: 'Appeal accepted after review',
6 moderatorId: 'mod_42',
7 unblockedAt: new Date().toISOString()
8};
9const userId: string = 'user_10089';
10const anonUserId: string = 'anon_7f3b';
11const result: UnBlockCommentPublic200Response = await unBlockUserFromComment(tenantId, id, unBlockFromCommentParams, userId, anonUserId);
12

unFlagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment200Response

Example

unFlagComment Example
Copy Copy
1
2const unflagResultLoggedIn: FlagComment200Response = await unFlagComment("tenant_3d9f2a_eu", "cmt_84b1f3", "user_1074");
3const unflagResultAnon: FlagComment200Response = await unFlagComment("tenant_3d9f2a_eu", "cmt_84b1f3", undefined, "anon_9x7y2");
4

unLockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment200Response

Example

unLockComment Example
Copy Copy
1
2const tenantId: string = 'acme-media-tenant-77';
3const commentId: string = 'cmt_9f8b3a6d';
4const broadcastId: string = 'live_2025-11-04_nightly-show';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature';
6const unlockedWithSSO: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId, sso);
7const unlockedWithoutSSO: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId);
8

unPinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment200Response

Example

unPinComment Example
Copy Copy
1
2const tenantId: string = 'tenant_82f5a3';
3const commentId: string = 'cmt_9a1b4d';
4const broadcastId: string = 'brd_3f2e9c';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature';
6
7const responseWithSso: PinComment200Response = await unPinComment(tenantId, commentId, broadcastId, ssoToken);
8const responseWithoutSso: PinComment200Response = await unPinComment(tenantId, commentId, broadcastId);
9

updateComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
body PickAPICommentUpdatableCommentFields Yes
contextUserId string No
doSpamCheck boolean No
isLive boolean No

Response

Returns: FlagCommentPublic200Response

Example

updateComment Example
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-72';
3const id: string = 'cmt_9a7f6b3e';
4const body: PickAPICommentUpdatableCommentFields = {
5 content: 'We fixed the formatting issue; thanks for reporting.',
6 isVisible: true,
7 metadata: { editedBy: 'moderator_jane', editReason: 'clarified wording' }
8};
9const contextUserId: string = 'moderator_jane';
10const doSpamCheck: boolean = true;
11const isLive: boolean = false;
12const result: FlagCommentPublic200Response = await updateComment(tenantId, id, body, contextUserId, doSpamCheck, isLive);
13

voteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
urlId string Yes
broadcastId string Yes
voteBodyParams VoteBodyParams Yes
sessionId string No
sso string No

Response

Returns: VoteComment200Response

Example

voteComment Example
Copy Copy
1
2const tenantId: string = 'tenant_4f2b9a';
3const commentId: string = 'cmt_00012345';
4const urlId: string = 'news/2025/11/04/ai-impact';
5const broadcastId: string = 'bcast_3a9f2d';
6const voteBodyParams: VoteBodyParams = { direction: 'up', weight: 1 };
7const sessionId: string = 'sess_9f8e7d6c';
8const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.signed';
9const result: VoteComment200Response = await voteComment(tenantId, commentId, urlId, broadcastId, voteBodyParams, sessionId, sso);
10

addDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
addDomainConfigParams AddDomainConfigParams Yes

Response

Returns: AddDomainConfig200Response

Example

addDomainConfig Example
Copy Copy
1
2const tenantId: string = "tenant_8f3c2a1b";
3const addDomainConfigParams: AddDomainConfigParams = {
4 domain: "discuss.myproduct.com",
5 cname: "fc-myproduct-comments.svc.fastcomments.net",
6 allowSubdomains: true, // optional
7 enforceHttps: true // optional
8};
9const result: AddDomainConfig200Response = await addDomainConfig(tenantId, addDomainConfigParams);
10

deleteDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: DeleteDomainConfig200Response

Example

deleteDomainConfig Example
Copy Copy
1
2const tenantId: string = 'tenant_01a2b3c4';
3const primaryDomain: string = 'comments.acme-corp.com';
4let optionalSubdomain: string | undefined = undefined; // optional override when present
5const domainToDelete: string = optionalSubdomain ?? primaryDomain;
6const response: DeleteDomainConfig200Response = await deleteDomainConfig(tenantId, domainToDelete);
7

getDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: GetDomainConfig200Response

Example

getDomainConfig Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-42';
3const defaultDomain: string = 'comments.acme.com';
4const domainOverride: string | undefined = undefined;
5const domain: string = domainOverride ?? defaultDomain;
6const result: GetDomainConfig200Response = await getDomainConfig(tenantId, domain);
7console.log(result);
8

getDomainConfigs Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetDomainConfigs200Response

Example

getDomainConfigs Example
Copy Copy
1
2const tenantId: string = "tenant_4f3b9a-west-1";
3const options: { includeDisabled?: boolean; environment?: "production" | "staging" } = { includeDisabled: true, environment: "production" };
4const response: GetDomainConfigs200Response = await getDomainConfigs(tenantId, options);
5

patchDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
patchDomainConfigParams PatchDomainConfigParams Yes

Response

Returns: GetDomainConfig200Response

Example

patchDomainConfig Example
Copy Copy
1
2const tenantId: string = "tenant_4f9d2a7c";
3const domainToUpdate: string = "comments.example-site.com";
4const patchDomainConfigParams: PatchDomainConfigParams = {
5 enabled: true,
6 enforceHttps: true, // optional parameter demonstrated
7 allowedOrigins: ["https://www.example.com"],
8 primary: false
9};
10const updatedConfig: GetDomainConfig200Response = await patchDomainConfig(tenantId, domainToUpdate, patchDomainConfigParams);
11

putDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
updateDomainConfigParams UpdateDomainConfigParams Yes

Response

Returns: GetDomainConfig200Response

Example

putDomainConfig Example
Copy Copy
1
2const tenantId: string = 'acme-corp-9f2b';
3const domainToUpdate: string = 'comments.acme.com';
4const updateDomainConfigParams: UpdateDomainConfigParams = {
5 primaryHost: 'comments.acme.com',
6 routeType: 'subdomain',
7 enableSsl: true,
8 sslCertificateId: undefined, // optional: left undefined to let system provision certificate
9 redirectToPrimaryHost: true,
10 allowedOrigins: ['https://www.acme.com', 'https://blog.acme.com']
11};
12const result: GetDomainConfig200Response = await putDomainConfig(tenantId, domainToUpdate, updateDomainConfigParams);
13

getEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime number Yes
endTime number Yes

Response

Returns: GetEventLog200Response

Example

getEventLog Example
Copy Copy
1
2const tenantId: string = 'tenant_8a4b2';
3const urlId: string = 'articles/2025/11/fastcomments-typescript-example';
4const maybeStartTime: number | undefined = undefined; // optional start time (demonstration)
5const startTime: number = maybeStartTime ?? Date.now() - 1000 * 60 * 60; // default to 1 hour ago
6const endTime: number = Date.now();
7const userIdWS: string = 'ws_user_789';
8const result: GetEventLog200Response = await getEventLog(tenantId, urlId, userIdWS, startTime, endTime);
9

getGlobalEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime number Yes
endTime number Yes

Response

Returns: GetEventLog200Response

Example

getGlobalEventLog Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_ab12cd34';
4 const urlId: string = 'url_9f8e7d6c';
5 const userIdWS: string = 'ws_user_5721';
6 const startTimeOverride: number | undefined = undefined; // optional override
7 const startTime: number = startTimeOverride ?? Date.now() - 7 * 24 * 60 * 60 * 1000; // last 7 days
8 const endTime: number = Date.now();
9 const response: GetEventLog200Response = await getGlobalEventLog(tenantId, urlId, userIdWS, startTime, endTime);
10 console.log(response);
11})();
12

createFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic200Response

Example

createFeedPostPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_corp_123';
3const createFeedPostParams: CreateFeedPostParams = {
4 title: 'Aurora 2.0 Launch',
5 body: "We're excited to announce Aurora 2.0 — faster load times and improved accessibility.",
6 links: [{ url: 'https://acme.example.com/aurora-2-release', title: 'Read release notes' }],
7 media: [{ type: 'image', assets: [{ url: 'https://cdn.example.com/aurora2-hero.jpg', mimeType: 'image/jpeg' }] }],
8 visibility: 'public',
9 tags: ['release', 'product'],
10 allowComments: true,
11 authorId: 'user_987'
12};
13const broadcastId: string = 'broadcast_2025_11_04_01';
14const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature';
15
16const result: CreateFeedPostPublic200Response = await createFeedPostPublic(tenantId, createFeedPostParams, broadcastId, sso);
17

deleteFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
broadcastId string No
sso string No

Response

Returns: DeleteFeedPostPublic200Response

Example

deleteFeedPostPublic Example
Copy Copy
1
2const tenantId: string = "tenant_82f7c3";
3const postId: string = "post_5b9a1f2a";
4const broadcastId: string = "broadcast_9f3d2b";
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI0NTY3OCIsImlhdCI6MTYxNjI3MjAwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
6const result: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId, broadcastId, sso);
7

getFeedPosts Internal Link

req tenantId afterId

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit number No
tags Array No

Response

Returns: GetFeedPosts200Response

Example

getFeedPosts Example
Copy Copy
1
2const tenantId: string = 'tenant_84f2b1';
3const afterId: string = 'post_000123';
4const limit: number = 25;
5const tags: Array<string> = ['breaking-news', 'release'];
6const feedResponse: GetFeedPosts200Response = await getFeedPosts(tenantId, afterId, limit, tags);
7const minimalResponse: GetFeedPosts200Response = await getFeedPosts('tenant_84f2b1');
8

getFeedPostsPublic Internal Link

req tenantId afterId

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit number No
tags Array No
sso string No
isCrawler boolean No
includeUserInfo boolean No

Response

Returns: GetFeedPostsPublic200Response

Example

getFeedPostsPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_8421';
3const afterId: string = 'post_20251101_007';
4const limit: number = 20;
5const tags: string[] = ['technology', 'product-launch'];
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_payload.signature';
7const isCrawler: boolean = false;
8const includeUserInfo: boolean = true;
9const response: GetFeedPostsPublic200Response = await getFeedPostsPublic(tenantId, afterId, limit, tags, sso, isCrawler, includeUserInfo);
10

getFeedPostsStats Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds Array Yes
sso string No

Response

Returns: GetFeedPostsStats200Response

Example

getFeedPostsStats Example
Copy Copy
1
2const tenantId: string = 'acme-corp-7';
3const postIds: string[] = [
4 'd4f1c3b2-6a9e-4a8b-9cde-0f1a2b3c4d5e',
5 'b2e1d0c3-5f6a-4b7c-8d9e-1a2b3c4d5e6f'
6];
7const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature';
8
9const statsNoSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds);
10const statsWithSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds, sso);
11

getUserReactsPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds Array No
sso string No

Response

Returns: GetUserReactsPublic200Response

Example

getUserReactsPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_8b3f7c2a';
3const postIds: Array<string> = ['post_6f4d2a1b', 'post_9c8e1d3f'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0MjMiLCJ0ZW5hbnQiOiJ0ZW5hbnRfOGIzZjdhIn0.signature';
5const result: GetUserReactsPublic200Response = await getUserReactsPublic(tenantId, postIds, sso);
6

reactFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
reactBodyParams ReactBodyParams Yes
isUndo boolean No
broadcastId string No
sso string No

Response

Returns: ReactFeedPostPublic200Response

Example

reactFeedPostPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_inc';
3const postId: string = 'post_2025_98765';
4const reactBodyParams: ReactBodyParams = { reactionType: 'heart', userId: 'user_712', source: 'web' };
5const isUndo: boolean = false;
6const broadcastId: string = 'bcast-3f7a9d2c';
7const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzcxMiJ9.signature';
8const result: ReactFeedPostPublic200Response = await reactFeedPostPublic(tenantId, postId, reactBodyParams, isUndo, broadcastId, sso);
9

updateFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
feedPost FeedPost Yes

Response

Returns: FlagCommentPublic200Response

Example

updateFeedPost Example
Copy Copy
1
2const tenantId: string = "acme-corp-9f3d";
3const id: string = "post_20251104_9876";
4const scheduledAt: string | undefined = undefined; // optional scheduling parameter
5const feedPost: FeedPost = {
6 title: "Q4 Product Roadmap & Priorities",
7 content: "Focus areas: stability, onboarding, and performance improvements across web and mobile.",
8 authorId: "user_84",
9 published: true,
10 tags: ["roadmap", "q4", "product"],
11 media: [
12 {
13 id: "media_01",
14 type: "image",
15 assets: [{ url: "https://cdn.acme.com/roadmap-q4.png", mimeType: "image/png", width: 1200, height: 800 }]
16 }
17 ],
18 links: [{ title: "Full changelog", url: "https://acme.com/changelog/q4" }],
19 scheduledAt
20};
21const result: FlagCommentPublic200Response = await updateFeedPost(tenantId, id, feedPost);
22

updateFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
updateFeedPostParams UpdateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic200Response

Example

updateFeedPostPublic Example
Copy Copy
1
2const tenantId: string = 'acme-corp';
3const postId: string = 'post_2025-11-04_9f2b';
4const updateFeedPostParams: UpdateFeedPostParams = {
5 title: 'Weekly Product Update',
6 body: 'Released search relevance improvements and bug fixes. Thanks to everyone who reported issues.',
7 isPublished: true,
8 tags: ['release', 'search'],
9 media: [{ url: 'https://cdn.acme-corp.com/images/update-2025-11-04.jpg', type: 'image' } as FeedPostMediaItem],
10};
11const broadcastId: string = 'broadcast_20251104_01';
12const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
13const response: CreateFeedPostPublic200Response = await updateFeedPostPublic(tenantId, postId, updateFeedPostParams, broadcastId, sso);
14

flagCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
isFlagged boolean Yes
sso string No

Response

Returns: FlagCommentPublic200Response

Example

flagCommentPublic Example
Copy Copy
1
2const tenantId: string = "tenant_42a7c";
3const commentId: string = "cmt_a7b9c3d2e4";
4const isFlagged: boolean = true;
5const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyOjEyMyIsImlhdCI6MTYwOTAwMDAwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
6const resultWithSSO: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, isFlagged, ssoToken);
7const resultWithoutSSO: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, false);
8

addPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIPageData CreateAPIPageData Yes

Response

Returns: AddPageAPIResponse

Example

addPage Example
Copy Copy
1
2async function run(): Promise<void> {
3 const tenantId: string = 'acme-tenant-us-east-1';
4 const createAPIPageData: CreateAPIPageData = {
5 url: 'https://blog.acme.com/product/2025/11/04/new-release',
6 title: 'Acme Product — November 2025 Release',
7 language: 'en-US',
8 tags: ['release', 'product'],
9 canonicalUrl: 'https://acme.com/blog/new-release-2025-11-04', // optional
10 allowComments: true, // optional
11 metadata: { author: 'Acme Engineering' } // optional
12 };
13 const response: AddPageAPIResponse = await addPage(tenantId, createAPIPageData);
14 console.log(response);
15}
16run();
17

deletePage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: DeletePageAPIResponse

Example

deletePage Example
Copy Copy
1
2const tenantId: string = "acme-corp-7a2f";
3const baseId: string = "page-2023-11-05-article-42";
4const envSuffix: string | undefined = "-staging";
5const id: string = envSuffix ? `${baseId}${envSuffix}` : baseId;
6const result: DeletePageAPIResponse = await deletePage(tenantId, id);
7

getPageByURLId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes

Response

Returns: GetPageByURLIdAPIResponse

Example

getPageByURLId Example
Copy Copy
1
2const tenantId: string = 'tenant_7f4c2b9a';
3const urlId: string = 'page_3b1f9a2c';
4const result: GetPageByURLIdAPIResponse = await getPageByURLId(tenantId, urlId);
5const pageTitle: string | undefined = (result as unknown as { page?: { title?: string } }).page?.title;
6

getPages Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetPagesAPIResponse

Example

getPages Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-9f4b2';
3const options: { pageSize?: number; includeDrafts?: boolean; cursor?: string } = { pageSize: 25, includeDrafts: false };
4const pages: GetPagesAPIResponse = await getPages(tenantId, options);
5

patchPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPIPageData UpdateAPIPageData Yes

Response

Returns: PatchPageAPIResponse

Example

patchPage Example
Copy Copy
1
2const tenantId: string = 'tenant-5f3b2a1c';
3const id: string = 'page-7d2a9b4f';
4const updateData: UpdateAPIPageData = {
5 title: 'Single Sign-On (SSO) Integration',
6 path: '/guides/sso/integration',
7 isPublished: true,
8 metadata: { author: 'Platform Docs', lastEdited: '2025-10-30' },
9 redirectUrl: undefined // optional parameter demonstrated
10};
11const result: PatchPageAPIResponse = await patchPage(tenantId, id, updateData);
12

aggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds Array No
urlId string No
timeBucket AggregateTimeBucket No
startDate Date No
forceRecalculate boolean No

Response

Returns: AggregateQuestionResults200Response

Example

aggregateQuestionResults Example
Copy Copy
1
2const tenantId: string = 'tenant_8f7d4';
3const questionIds: string[] = ['q_42', 'q_43'];
4const urlId: string = 'page_3a9';
5const timeBucket: AggregateTimeBucket = 'monthly' as unknown as AggregateTimeBucket;
6const startDate: Date = new Date('2025-01-01T00:00:00Z');
7const forceRecalculate: boolean = true;
8const result: AggregateQuestionResults200Response = await aggregateQuestionResults(tenantId, undefined, questionIds, urlId, timeBucket, startDate, forceRecalculate);
9

bulkAggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
bulkAggregateQuestionResultsRequest BulkAggregateQuestionResultsRequest Yes
forceRecalculate boolean No

Response

Returns: BulkAggregateQuestionResults200Response

Example

bulkAggregateQuestionResults Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_4f3a2b1c';
4 const forceRecalculate: boolean = true;
5 const bulkAggregateQuestionResultsRequest: BulkAggregateQuestionResultsRequest = {
6 items: [
7 {
8 questionId: 'question_9876',
9 timeframe: { start: '2025-10-01T00:00:00Z', end: '2025-10-31T23:59:59Z' },
10 buckets: [
11 { start: '2025-10-01T00:00:00Z', end: '2025-10-07T23:59:59Z' },
12 { start: '2025-10-08T00:00:00Z', end: '2025-10-15T23:59:59Z' }
13 ]
14 } as BulkAggregateQuestionItem
15 ] as BulkAggregateQuestionItem[]
16 };
17 const result: BulkAggregateQuestionResults200Response = await bulkAggregateQuestionResults(tenantId, bulkAggregateQuestionResultsRequest, forceRecalculate);
18 console.log(result);
19})();
20

combineCommentsWithQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds Array No
urlId string No
startDate Date No
forceRecalculate boolean No
minValue number No
maxValue number No
limit number No

Response

Returns: CombineCommentsWithQuestionResults200Response

Example

combineCommentsWithQuestionResults Example
Copy Copy
1
2const tenantId: string = 'tenant_9b2f6c';
3const questionIds: string[] = ['poll-2025-10', 'topic-42'];
4const urlId: string = 'url_5d7a1e';
5const startDate: Date = new Date('2025-09-01T08:00:00Z');
6const forceRecalculate: boolean = true;
7const minValue: number = 1;
8const maxValue: number = 5;
9const limit: number = 50;
10const result: CombineCommentsWithQuestionResults200Response = await combineCommentsWithQuestionResults(
11 tenantId,
12 undefined,
13 questionIds,
14 urlId,
15 startDate,
16 forceRecalculate,
17 minValue,
18 maxValue,
19 limit
20);
21

addSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPISSOUserData CreateAPISSOUserData Yes

Response

Returns: AddSSOUserAPIResponse

Example

addSSOUser Example
Copy Copy
1
2const tenantId: string = "acme-corp-tenant-42";
3const createUser: CreateAPISSOUserData = {
4 id: "u-7f3b9",
5 email: "jane.doe@acme-corp.com",
6 username: "jane.doe",
7 displayName: "Jane Doe", // optional
8 roles: ["moderator"], // optional
9 metadata: { department: "Marketing" } // optional
10};
11const result: AddSSOUserAPIResponse = await addSSOUser(tenantId, createUser);
12

deleteSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
deleteComments boolean No
commentDeleteMode string No

Response

Returns: DeleteSSOUserAPIResponse

Example

deleteSSOUser Example
Copy Copy
1
2const tenantId: string = "fc_tenant_8f3b2a9c";
3const id: string = "sso_user_5c9d2b";
4const deleteComments: boolean = true;
5const commentDeleteMode: string = "anonymize";
6const result: DeleteSSOUserAPIResponse = await deleteSSOUser(tenantId, id, deleteComments, commentDeleteMode);
7

getSSOUserByEmail Internal Link

Parameters

Name Type Required Description
tenantId string Yes
email string Yes

Response

Returns: GetSSOUserByEmailAPIResponse

Example

getSSOUserByEmail Example
Copy Copy
1
2type FetchOptions = { includeDeactivated?: boolean };
3
4const tenantId: string = "acme-tenant-84";
5const email: string = "jane.doe@acme.com";
6const options: FetchOptions = { includeDeactivated: true };
7
8const result: GetSSOUserByEmailAPIResponse = await getSSOUserByEmail(tenantId, email);
9const ssoUser: APISSOUser | undefined = (result as unknown as { user?: APISSOUser })?.user
10

getSSOUserById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetSSOUserByIdAPIResponse

Example

getSSOUserById Example
Copy Copy
1
2const tenantId: string = 'tenant_9a1b2c_org_4f3b2a';
3const userId: string = 'sso_user_8c7d6e5f';
4const response: GetSSOUserByIdAPIResponse = await getSSOUserById(tenantId, userId);
5const ssoUser: APISSOUser | undefined = (response as unknown as { user?: APISSOUser }).user;
6const email: string | undefined = ssoUser?.email;
7

getSSOUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetSSOUsers200Response

Example

getSSOUsers Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_8a3c4b2e';
4 const ssoResultDefault: GetSSOUsers200Response = await getSSOUsers(tenantId);
5 const ssoResultPaged: GetSSOUsers200Response = await getSSOUsers(tenantId, 50);
6 console.log(ssoResultDefault, ssoResultPaged);
7})();
8

patchSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments boolean No

Response

Returns: PatchSSOUserAPIResponse

Example

patchSSOUser Example
Copy Copy
1
2const tenantId: string = "tenant_acme_987";
3const id: string = "ssouser_0042";
4const updateAPISSOUserData: UpdateAPISSOUserData = {
5 email: "jane.doe@acmecorp.com",
6 displayName: "Jane Doe",
7 externalId: "okta|00u1abcd2345EFGHIJ6",
8 roles: ["moderator"],
9 active: true,
10 metadata: { team: "Customer Success", location: "NYC" },
11};
12const updateComments: boolean = true;
13const result: PatchSSOUserAPIResponse = await patchSSOUser(tenantId, id, updateAPISSOUserData, updateComments);
14

putSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments boolean No

Response

Returns: PutSSOUserAPIResponse

Example

putSSOUser Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01'
3const id: string = 'user_987654321'
4const updateAPISSOUserData: UpdateAPISSOUserData = {
5 email: 'jane.doe@acme.com',
6 displayName: 'Jane Doe',
7 roles: ['editor'],
8 externalId: 'sso|12345',
9 avatarUrl: 'https://cdn.acme.com/avatars/jane.jpg',
10 isActive: true,
11 metadata: { department: 'Product' }
12}
13const updateComments: boolean = true
14const result: PutSSOUserAPIResponse = await putSSOUser(tenantId, id, updateAPISSOUserData, updateComments)
15console.log(result)
16

createSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIUserSubscriptionData CreateAPIUserSubscriptionData Yes

Response

Returns: CreateSubscriptionAPIResponse

Example

createSubscription Example
Copy Copy
1
2const tenantId: string = "fc_tenant_9b2c4f";
3const createAPIUserSubscriptionData: CreateAPIUserSubscriptionData = {
4 userId: "user_72a1",
5 email: "jane.doe@acme-corp.com",
6 planId: "pro_annual",
7 paymentMethod: { type: "card", brand: "Visa", last4: "4242" },
8 autoRenew: true,
9 trialEndsAt: "2026-01-15T00:00:00Z", // optional parameter
10 metadata: { company: "Acme Corp", role: "editor" } // optional
11};
12const response: CreateSubscriptionAPIResponse = await createSubscription(tenantId, createAPIUserSubscriptionData);
13

deleteSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No

Response

Returns: DeleteSubscriptionAPIResponse

Example

deleteSubscription Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_acme_news_01';
4 const subscriptionId: string = 'sub_5f3b9a1c';
5 const response1: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId);
6 const userId: string = 'user_4b9d2e';
7 const response2: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId, userId);
8 console.log(response1, response2);
9})();
10

getSubscriptions Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No

Response

Returns: GetSubscriptionsAPIResponse

Example

getSubscriptions Example
Copy Copy
1
2const tenantId: string = "acme-tenant-001";
3const subscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId);
4
5const userId: string = "user_jane.doe@acme.com";
6const userSubscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId, userId);
7

uploadImage Internal Link

Upload and resize an image

Parameters

Name Type Required Description
tenantId string Yes
file Blob Yes
sizePreset SizePreset No
urlId string No

Response

Returns: UploadImageResponse

Example

uploadImage Example
Copy Copy
1
2const tenantId: string = 'fc-tenant-9a8b7c';
3const pngData: Uint8Array = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
4const file: Blob = new Blob([pngData], { type: 'image/png' });
5const sizePreset: SizePreset = { width: 800, height: 800, fit: 'cover' };
6const urlId: string = 'profiles/8f3d1a-avatar';
7const result: UploadImageResponse = await uploadImage(tenantId, file, sizePreset, urlId);
8

getUserBadgeProgressById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressById Example
Copy Copy
1
2const tenantId: string = "acme-media-592";
3const suffix: string | undefined = "mobile"; // optional parameter that may modify which user id to request
4const id: string = suffix ? `user_9f8b2a-${suffix}` : "user_9f8b2a";
5const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressById(tenantId, id);
6console.log(result);
7

getUserBadgeProgressByUserId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressByUserId Example
Copy Copy
1
2const tenantId: string = 'tenant_58a1c3';
3const userId: string = 'user_b2f4e9a7';
4const progress: GetUserBadgeProgressById200Response = await getUserBadgeProgressByUserId(tenantId, userId);
5

getUserBadgeProgressList Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
limit number No
skip number No

Response

Returns: GetUserBadgeProgressList200Response

Example

getUserBadgeProgressList Example
Copy Copy
1
2const tenantId: string = "tenant_acme_2025";
3const userId: string = "user_00123";
4const limit: number = 25;
5const skip: number = 0;
6const badgeProgress: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId, userId, limit, skip);
7const badgeProgressAll: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId);
8

createUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createUserBadgeParams CreateUserBadgeParams Yes

Response

Returns: CreateUserBadge200Response

Example

createUserBadge Example
Copy Copy
1
2const tenantId: string = "tenant_82b9e3";
3const createUserBadgeParams: CreateUserBadgeParams = {
4 key: "expert-contributor",
5 title: "Expert Contributor",
6 description: "Awarded for consistently helpful technical answers",
7 imageUrl: "https://cdn.fastcomments.example/badges/expert.png",
8 isPublic: true,
9 tier: 2,
10 // optional parameters
11 metadata: { awardedBy: "moderation-team", createdAt: "2025-10-30T12:00:00Z" },
12 expiresAt: "2026-10-30T12:00:00Z"
13};
14const createdBadge: CreateUserBadge200Response = await createUserBadge(tenantId, createUserBadgeParams);
15

deleteUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: UpdateUserBadge200Response

Example

deleteUserBadge Example
Copy Copy
1
2const tenantId: string = 'tenant_9f1b2c34';
3const id: string = 'badge_7a3d2f59';
4type DeleteOptions = { notifySubscribers?: boolean }; // optional parameter shape
5const options: DeleteOptions = { notifySubscribers: true };
6const result: UpdateUserBadge200Response = await deleteUserBadge(tenantId, id);
7

getUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadge200Response

Example

getUserBadge Example
Copy Copy
1
2const tenantIdOptional: string | undefined = process.env.TENANT_ID;
3const tenantId: string = tenantIdOptional ?? 'tenant_acme_corp_42';
4const badgeId: string = 'badge_7f3a9d2';
5const response: GetUserBadge200Response = await getUserBadge(tenantId, badgeId);
6console.log(response);
7

getUserBadges Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
badgeId string No
type number No
displayedOnComments boolean No
limit number No
skip number No

Response

Returns: GetUserBadges200Response

Example

getUserBadges Example
Copy Copy
1
2const tenantId: string = "tenant_acme_site_01";
3const userId: string = "user_7b9f3d";
4const badgeId: string = "badge_top_contributor";
5const type: number = 2;
6const displayedOnComments: boolean = true;
7const limit: number = 20;
8const skip: number = 0;
9const response: GetUserBadges200Response = await getUserBadges(tenantId, userId, badgeId, type, displayedOnComments, limit, skip);
10

updateUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateUserBadgeParams UpdateUserBadgeParams Yes

Response

Returns: UpdateUserBadge200Response

Example

updateUserBadge Example
Copy Copy
1
2const tenantId: string = "tenant_9f3b2c";
3const id: string = "badge_42a1";
4const updateUserBadgeParams: UpdateUserBadgeParams = {
5 name: "Top Contributor",
6 description: "Awarded for 1,000 helpful posts across the community",
7 level: 4,
8 iconUrl: "https://cdn.fastcomments.com/badges/top-contributor.png",
9 isActive: true,
10 notifyUser: true, // optional flag
11 expiresAt: "2027-01-01T00:00:00Z" // optional expiry
12};
13const result: UpdateUserBadge200Response = await updateUserBadge(tenantId, id, updateUserBadgeParams);
14

getUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: GetUserNotificationCount200Response

Example

getUserNotificationCount Example
Copy Copy
1
2const tenantId: string = 'tenant_84b7c2';
3const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiamRvZSIsImlhdCI6MTY5MDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
4const notificationCountWithoutSSO: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId);
5const notificationCountWithSSO: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId, ssoToken);
6

getUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
pageSize number No
afterId string No
includeContext boolean No
afterCreatedAt number No
unreadOnly boolean No
dmOnly boolean No
noDm boolean No
includeTranslations boolean No
sso string No

Response

Returns: GetUserNotifications200Response

Example

getUserNotifications Example
Copy Copy
1
2const tenantId: string = 'tenant-12345';
3const pageSize: number = 25;
4const includeContext: boolean = true;
5const afterCreatedAt: number = Date.now() - 24 * 60 * 60 * 1000;
6const unreadOnly: boolean = true;
7const includeTranslations: boolean = false;
8const sso: string = 'sso-eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
9const notifications: GetUserNotifications200Response = await getUserNotifications(
10 tenantId,
11 pageSize,
12 undefined,
13 includeContext,
14 afterCreatedAt,
15 unreadOnly,
16 undefined,
17 undefined,
18 includeTranslations,
19 sso
20);
21

resetUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotificationCount Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-corp-78';
4 const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakeSignature';
5 const responseWithSso: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId, ssoToken);
6 const responseWithoutSso: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId);
7 console.log(responseWithSso, responseWithoutSso);
8})();
9

resetUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
afterCreatedAt number No
unreadOnly boolean No
dmOnly boolean No
noDm boolean No
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotifications Example
Copy Copy
1
2const tenantId: string = 'tenant_12345';
3const afterId: string = 'notif_98765';
4const afterCreatedAt: number = Date.now() - 1000 * 60 * 60 * 24;
5const unreadOnly: boolean = true;
6const dmOnly: boolean = false;
7const noDm: boolean = false;
8const sso: string = 'sso_jwt_token_eyJhbGciOiJIUzI1Ni';
9const result: ResetUserNotifications200Response = await resetUserNotifications(tenantId, afterId, afterCreatedAt, unreadOnly, dmOnly, noDm, sso);
10

updateUserNotificationCommentSubscriptionStatus Internal Link

Enable or disable notifications for a specific comment.

Parameters

Name Type Required Description
tenantId string Yes
notificationId string Yes
optedInOrOut UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum Yes
commentId string Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationCommentSubscriptionStatus Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_84f3a2';
4 const notificationId: string = 'notif_7b9c2f';
5 const optedInOrOut: UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum = 'opted_in' as UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum;
6 const commentId: string = 'comment_582b3';
7 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
8 const result: UpdateUserNotificationStatus200Response = await updateUserNotificationCommentSubscriptionStatus(tenantId, notificationId, optedInOrOut, commentId, sso);
9 console.log(result);
10})();
11

updateUserNotificationPageSubscriptionStatus Internal Link

Enable or disable notifications for a page. When users are subscribed to a page, notifications are created for new root comments, and also

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
url string Yes
pageTitle string Yes
subscribedOrUnsubscribed UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationPageSubscriptionStatus Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_acme_01';
4 const urlId: string = 'post-2025-11-04-8742';
5 const url: string = 'https://acme.example.com/posts/ai-update';
6 const pageTitle: string = 'AI Update — November 2025';
7 const subscribedOrUnsubscribed: UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum = UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum.SUBSCRIBED;
8 const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.payload';
9 const resultWithSso: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, subscribedOrUnsubscribed, ssoToken);
10 const resultWithoutSso: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum.UNSUBSCRIBED);
11 console.log(resultWithSso, resultWithoutSso);
12})();
13

updateUserNotificationStatus Internal Link

Parameters

Name Type Required Description
tenantId string Yes
notificationId string Yes
newStatus UpdateUserNotificationStatusNewStatusEnum Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationStatus Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_acme_01';
4 const notificationId: string = 'notif_2025-11-04-7890';
5 const ssoToken: string | undefined = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
6 const result: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(
7 tenantId,
8 notificationId,
9 UpdateUserNotificationStatusNewStatusEnum.READ,
10 ssoToken
11 );
12 console.log(result);
13})();
14

getUserPresenceStatuses Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlIdWS string Yes
userIds string Yes

Response

Returns: GetUserPresenceStatuses200Response

Example

getUserPresenceStatuses Example
Copy Copy
1
2const tenantId: string = 'tenant_7d9a3b';
3const urlIdWS: string | undefined = 'ws-4b8f2'; // optional at runtime
4const userIds: string = 'user_1024,user_2048';
5const result: GetUserPresenceStatuses200Response = await getUserPresenceStatuses(tenantId, urlIdWS ?? 'ws-4b8f2', userIds);
6

searchUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
usernameStartsWith string Yes
mentionGroupIds Array No
sso string No

Response

Returns: SearchUsers200Response

Example

searchUsers Example
Copy Copy
1
2const tenantId: string = 'tenant_9a8b7c';
3const urlId: string = 'article-67890-latest-news';
4const usernameStartsWith: string = 'alex';
5const mentionGroupIds: Array<string> = ['editors', 'community-moderators'];
6const sso: string = 'sso-jwt-abc123def456';
7const usersResponse: SearchUsers200Response = await searchUsers(tenantId, urlId, usernameStartsWith, mentionGroupIds, sso);
8

Need Help?

If you encounter any issues or have questions about the JavaScript/TypeScript SDK, please:

Contributing

Contributions are welcome! Please visit the GitHub repository for contribution guidelines.