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
2(async () => {
3 const tenantId: string = 'tenant_12345';
4 const parentTenantId: string = 'org_98765';
5 const includeStats: boolean = true;
6 const aggregationRequest: AggregationRequest = {
7 predicates: [
8 { field: 'createdAt', operator: 'gte', value: '2025-01-01T00:00:00Z' } as QueryPredicate
9 ],
10 operations: [
11 { type: 'COUNT' as AggregationOpType, field: 'status' } as AggregationOperation
12 ],
13 sort: [{ field: 'count', direction: 'desc' }] as AggregationRequestSort,
14 limit: 25
15 };
16 const response: AggregationResponse = await aggregate(tenantId, aggregationRequest, parentTenantId, includeStats);
17 console.log(response);
18})();
19

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 = 'tenant_8f7b2c';
3const limit: number = 100;
4const skip: number = 0;
5const order: SORTDIR = 'desc' as unknown as SORTDIR;
6const after: number = Math.floor(Date.now() / 1000) - 7 * 24 * 60 * 60;
7const result: GetAuditLogs200Response = await getAuditLogs(tenantId, limit, skip, order, after);
8

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_acme_001";
3const commentId: string = "comment_9f8b7c";
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: "abusive_language",
6 durationHours: 48,
7 notifyCommenter: true,
8 moderatorId: "moderator_42"
9};
10const sso: string = "sso_jwt_token_example_eyJhbGciOiJIUzI1Ni";
11const result: BlockFromCommentPublic200Response = await blockFromCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
12

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 = 'acme-tenant-84';
3const commentId: string = 'cmt_987654321';
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: 'erroneous moderation',
6 unblockedBy: 'moderator.jane.doe@acme.com',
7 notes: 'User appeal validated; content restored',
8 restoreReplies: true
9};
10const sso: string | undefined = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
11const result: UnBlockCommentPublic200Response = await unBlockCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
12

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_acme_42';
3const commentIds: string = 'cmt_9a1b,cmt_4f3d';
4const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyX2UxMjMiLCJpYXQiOjE2MzAwMDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
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 = 'acme-tenant-004';
3const commentId: string = 'cmt-9f2a3b4c';
4const blockFromCommentParams: BlockFromCommentParams = {
5 reason: 'Repeated spam and promotional links',
6 durationDays: 30,
7 blockReplies: true,
8 notifyModerators: true
9};
10const userId: string = 'user-000123';
11const anonUserId: string = 'anon-8f7b2c';
12const result: BlockFromCommentPublic200Response = await blockUserFromComment(tenantId, commentId, 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_8b3f2a';
3const urlId: string = 'articles/2025/11/solar-eclipse-grid-impact';
4const broadcastId: string = 'broadcast_4721';
5const commentData: CommentData = {
6 body: 'Thanks for the in-depth coverage — wondering how local utilities are preparing for the eclipse day demand spike.',
7 parentId: null,
8 authorName: 'Jordan Meyers',
9 authorEmail: 'j.meyers@newsdaily.com',
10 mentions: [{ userId: 'user_2468', displayName: 'Alex Rivera' }],
11 hashtags: [{ tag: 'solar-eclipse' }],
12 metadata: { device: 'desktop', browser: 'Chrome/120' }
13};
14const sessionId: string = 'sess_9f3a2b7c';
15const sso: string = 'sso.jwt.token.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
16const result: CreateCommentPublic200Response = await createCommentPublic(tenantId, urlId, broadcastId, commentData, sessionId, sso);
17

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
2(async () => {
3 const tenantId: string = "acme-corp-tenant-904";
4 const id: string = "cmt_7f84d2a9";
5 const contextUserId: string = "moderator_21";
6 const isLive: boolean = true;
7 const result: DeleteComment200Response = await deleteComment(tenantId, id, contextUserId, isLive);
8 console.log(result);
9})();
10

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_42ac9b0f';
3const commentId: string = 'cmt_5f8b7d3a9c';
4const broadcastId: string = 'broadcast_2025-11-22T12:00:00Z';
5const editKey: string = 'edk-3b9f7a2c';
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fake.signature';
7const result: DeleteCommentPublic200Response = await deleteCommentPublic(tenantId, commentId, broadcastId, editKey, sso);
8console.log(result);
9

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
2(async function run(): Promise<void> {
3 const tenantId: string = "tenant_9f3d2b1a";
4 const commentId: string = "comment_72a9f4e1";
5 const voteId: string = "vote_8d1a3c5b";
6 const urlId: string = "url_4b6d9e2f";
7 const broadcastId: string = "broadcast_2025-11-22_01";
8 const editKey: string | undefined = "editkey_6a1b2c3d";
9 const sso: string | undefined = "sso_jwt_token_example";
10 const result: DeleteCommentVote200Response = await deleteCommentVote(tenantId, commentId, voteId, urlId, broadcastId, editKey, sso);
11 console.log(result);
12})();
13

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-acme-01';
3const commentId: string = 'cmt_5f8e9a2b';
4const userId: string = 'user_1024';
5
6const flaggedByUserResponse: FlagComment200Response = await flagComment(tenantId, commentId, userId);
7
8const anonUserId: string = 'anon_9f2b3c';
9const flaggedAnonResponse: FlagComment200Response = await flagComment(tenantId, commentId, undefined, anonUserId);
10

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 = "acme-corp-tenant-01";
3const commentId: string | undefined = "cmt_9f8e7d6c5b4a"; // optional-style variable
4const result: GetComment200Response = await getComment(tenantId, commentId!);
5

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
2(async () => {
3 const tenantId: string = 'tenant_12345';
4 const result: GetComments200Response = await getComments(
5 tenantId,
6 1, // page
7 25, // limit
8 0, // skip
9 true, // asTree
10 0, // skipChildren
11 3, // limitChildren
12 5, // maxTreeDepth
13 'news-article-20251122-abc123', // urlId
14 'user_7890', // userId
15 'anon_456', // anonUserId
16 'moderator_101', // contextUserId
17 'discussion', // hashTag
18 'comment_9876', // parentId
19 SortDirections.DESC // direction
20 );
21 console.log(result);
22})();
23

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 = 'tenant_acme_001';
3const urlId: string = 'article/2025/launch';
4const page: number = 1;
5const direction: SortDirections = 'newest' as unknown as SortDirections;
6const limit: number = 25;
7const limitChildren: number = 3;
8const countChildren: boolean = true;
9const includeConfig: boolean = true;
10const response: GetCommentsPublic200Response = await getCommentsPublic(tenantId, urlId, page, direction, undefined, 0, 0, limit, limitChildren, countChildren, undefined, includeConfig);
11

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 = 'tenant_8a3f4b2c';
4 const commentId: string = 'cmt_9f4d3a2b';
5 const resultBasic: GetCommentText200Response = await getCommentText(tenantId, commentId);
6 const editKey: string = 'EK-4f3b2a1c';
7 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
8 const resultWithOpts: GetCommentText200Response = await getCommentText(tenantId, commentId, editKey, sso);
9 console.log(resultBasic, resultWithOpts);
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
2(async () => {
3 const tenantId: string = 'fc_tenant_42';
4 const commentId: string = 'cmt_9f8e7d6';
5 const dir: number = 1;
6 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0MjMiLCJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20ifQ.signature';
7
8 const result: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir);
9 const resultWithSSO: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir, sso);
10
11 console.log(result, resultWithSSO);
12})();
13

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_acme_987';
3const commentId: string = 'comment_10293';
4const broadcastId: string = 'broadcast_live_20251122';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyIsImlhdCI6MTY5OTk5OTk5OX0.signature';
6
7const lockResultNoSso: LockComment200Response = await lockComment(tenantId, commentId, broadcastId);
8const lockResultWithSso: LockComment200Response = await lockComment(tenantId, commentId, broadcastId, ssoToken);
9

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
2(async () => {
3 const tenantId: string = "tenant_42f7a1";
4 const commentId: string = "cmt-5e8d3c9a";
5 const broadcastId: string = "bcast-20251122-01";
6 const sso: string | undefined = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example_signature";
7 const pinned: PinComment200Response = await pinComment(tenantId, commentId, broadcastId, sso);
8 console.log(pinned);
9})();
10

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_6f9a2b4c';
3const createCommentParams: CreateCommentParams = {
4 threadId: 'article_2025-11-22_001',
5 content: 'Great analysis — I learned a lot from this breakdown.',
6 userId: 'user_00421',
7 userDisplayName: 'Aisha Patel',
8 userEmail: 'aisha.patel@example.org',
9 metadata: { device: 'iPhone', locale: 'en-US' }
10};
11const isLive: boolean = true;
12const doSpamCheck: boolean = true;
13const sendEmails: boolean = false;
14const populateNotifications: boolean = true;
15const result: SaveComment200Response = await saveComment(tenantId, createCommentParams, isLive, doSpamCheck, sendEmails, populateNotifications);
16

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
2(async () => {
3 const tenantId: string = 'tenant_7f4b21';
4 const createCommentParams: CreateCommentParams[] = [
5 {
6 content: 'I learned a lot from this post. Thanks for the practical tips!',
7 authorName: 'Sofia Ramos',
8 authorEmail: 'sofia.ramos@techblog.com',
9 userId: 'user_89237',
10 threadId: 'article-2025-11-typescript-tips',
11 url: 'https://techblog.com/posts/typescript-tips',
12 mentions: [{ userId: 'user_102', username: 'devMike' } as CommentUserMentionInfo],
13 hashtags: [{ tag: 'typescript' } as CommentUserHashTagInfo],
14 createdAt: new Date().toISOString()
15 }
16 ];
17 const isLive: boolean = true;
18 const doSpamCheck: boolean = true;
19 const sendEmails: boolean = false;
20 const populateNotifications: boolean = true;
21 const result: Array<SaveComment200Response> = await saveCommentsBulk(
22 tenantId,
23 createCommentParams,
24 isLive,
25 doSpamCheck,
26 sendEmails,
27 populateNotifications
28 );
29 console.log(result);
30})();
31

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_981c';
3const commentId: string = 'cmt-2048';
4const broadcastId: string = 'broadcast-nyc-2025-11-22';
5const commentTextUpdateRequest: CommentTextUpdateRequest = {
6 text: 'Thanks for the update — I think @maria raises a good point. See #product-roadmap',
7 mentions: [{ userId: 'user_maria', displayName: 'María López' }],
8 hashtags: [{ tag: 'product-roadmap' }]
9};
10const editKey: string = 'editkey_7f3a';
11const sso: string = 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
12const result: SetCommentText200Response = await setCommentText(tenantId, commentId, broadcastId, commentTextUpdateRequest, editKey, sso);
13

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
2(async () => {
3 const tenantId: string = 'tenant_9c2f7b';
4 const id: string = 'comment_6a1b2c3d';
5 const unBlockFromCommentParams: UnBlockFromCommentParams = {
6 reason: 'User appealed; evidence reviewed and ban lifted',
7 liftedByAdminId: 'admin_42',
8 effectiveAt: new Date().toISOString()
9 };
10 const userId: string = 'user_1024';
11 const anonUserId: string = 'anon_7f9e';
12 const response: UnBlockCommentPublic200Response = await unBlockUserFromComment(tenantId, id, unBlockFromCommentParams, userId, anonUserId);
13 console.log(response);
14})();
15

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 tenantId: string = 'fastcomments_tenant_001';
3const commentId: string = 'comment_55f3a2';
4const userId: string = 'user_7890';
5const anonUserId: string = 'anon_1a2b3c';
6const result: FlagComment200Response = await unFlagComment(tenantId, commentId, userId, anonUserId);
7

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 = 'tenant_acme_82';
3const commentId: string = 'f47ac10b-58cc-4372-a567-0e02b2c3d479';
4const broadcastId: string = 'live-event-2025-11-22';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyX2lkIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
6const resultWithSso: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId, ssoToken);
7const resultWithoutSso: 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_84a2c1';
3const commentId: string = 'cmt-9f2b6d7a';
4const broadcastId: string = 'live-20251122-nyc';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoidXNlcjEyMyIsImlhdCI6MTY5MDUwMDAwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
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
updatableCommentParams UpdatableCommentParams Yes
contextUserId string No
doSpamCheck boolean No
isLive boolean No

Response

Returns: FlagCommentPublic200Response

Example

updateComment Example
Copy Copy
1
2const tenantId: string = "tenant_7b6f3a2c";
3const id: string = "cmt_5f4e3a2b1d";
4const updatableCommentParams: UpdatableCommentParams = {
5 content: "I've updated my comment to add more context and fix a typo.",
6 authorName: "Jordan Lee",
7 meta: { editedBy: "moderator_12", tags: ["clarified"] },
8 isVisible: true
9};
10const contextUserId: string = "user_98c3b";
11const doSpamCheck: boolean = true;
12const isLive: boolean = true;
13const result: FlagCommentPublic200Response = await updateComment(tenantId, id, updatableCommentParams, contextUserId, doSpamCheck, isLive);
14

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_news_42';
3const commentId: string = 'cmt_5f8b9a2e';
4const urlId: string = '/news/2025/11/22/election-results';
5const broadcastId: string = 'brd_7f4a3';
6const voteBodyParams: VoteBodyParams = { direction: 'up', weight: 1, reason: 'Helpful and on-topic' };
7const sessionId: string = 'sess-9b8a7c6d1234';
8const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.signedPayload';
9
10const result: VoteComment200Response = await voteComment(tenantId, commentId, urlId, broadcastId, voteBodyParams, sessionId, sso);
11

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_7f3c9b2a9e1";
3const addDomainConfigParams: AddDomainConfigParams = {
4 domain: "comments.production.example.com",
5 enableHttps: true,
6 allowedOrigins: ["https://example.com", "https://dashboard.example.com"],
7 cname: undefined, // optional parameter explicitly omitted
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 | undefined = 'org-4f1a2b';
3const domain: string = 'comments.acme-corp.com';
4const result: DeleteDomainConfig200Response = await deleteDomainConfig(tenantId!, domain);
5

getDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: GetDomainConfig200Response

Example

getDomainConfig Example
Copy Copy
1
2const region: string | undefined = 'eu';
3const tenantId: string = region ? `acme-tenant-82a3f-${region}` : 'acme-tenant-82a3f';
4const domain: string = 'comments.acme-corp.com';
5const previewMode: boolean | undefined = true;
6const response: GetDomainConfig200Response = await getDomainConfig(tenantId, domain);
7

getDomainConfigs Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetDomainConfigs200Response

Example

getDomainConfigs Example
Copy Copy
1
2const tenantId: string = 'acme-marketing-1a2b';
3const includeInactive: boolean | undefined = undefined; // optional parameter demonstration
4const options: { includeInactive?: boolean } = includeInactive === undefined ? {} : { includeInactive };
5const response: GetDomainConfigs200Response = await getDomainConfigs(tenantId);
6/* Optional parameters can be supplied as a second argument when available, e.g.:
7 await getDomainConfigs(tenantId, { includeInactive: true }) */
8

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_4f2b1a9e-6c3d-4e5f-b1a2-abcdef123456";
3const domainToUpdate: string = "comments.acme-products.com";
4const patchDomainConfigParams: PatchDomainConfigParams = {
5 primary: true,
6 enableSsl: true,
7 sslCertificateId: "ssl_cert_72f4b1",
8 allowedOrigins: ["https://www.acme.com", "https://shop.acme.com"],
9 forceHttpsRedirect: undefined
10};
11const updatedConfig: GetDomainConfig200Response = await patchDomainConfig(tenantId, domainToUpdate, patchDomainConfigParams);
12

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';
3const domainToUpdate: string = 'comments.acme.com';
4const updateDomainConfigParams: UpdateDomainConfigParams = {
5 enableSsl: true,
6 certificateProvider: 'letsencrypt',
7 redirectHttpToHttps: true, // optional parameter demonstrated
8 customCssUrl: 'https://cdn.acme.com/widgets/comments.css',
9 moderationMode: 'pre-moderation',
10 allowedOrigins: ['https://www.acme.com', 'https://blog.acme.com']
11};
12const updatedConfig: 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_8a1f4';
3const maybeUrlId: string | undefined = 'articles/2025/product-launch';
4const urlId: string = maybeUrlId!;
5const userIdWS: string = 'ws_user_4521';
6const startTime: number = Date.now() - 1000 * 60 * 60 * 24; // 24 hours ago
7const endTime: number = Date.now();
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
2const tenantId: string = 'acme_media_tenant_001';
3const urlId: string = 'article-2025-11-22-fiber-upgrade';
4const userIdWS: string = 'ws_user_78321';
5const startTime: number = Date.now() - 1000 * 60 * 60 * 24; // 24 hours ago
6const endTime: number = Date.now();
7// Optional parameters example (not required by getGlobalEventLog)
8const options: { includeMetadata?: boolean; maxEntries?: number } = { includeMetadata: true };
9const result: GetEventLog200Response = await getGlobalEventLog(tenantId, urlId, userIdWS, startTime, endTime);
10console.log(result);
11

createFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
isLive boolean No
doSpamCheck boolean No
skipDupCheck boolean No

Response

Returns: CreateFeedPost200Response

Example

createFeedPost Example
Copy Copy
1
2const tenantId: string = 'tenant_9f2b1c';
3
4const createFeedPostParams: CreateFeedPostParams = ({
5 title: 'Feature X US Launch',
6 body: 'Feature X is now available to all US customers. See rollout details and known issues below.',
7 authorId: 'user_8421',
8 tags: ['launch', 'feature-x', 'us'],
9 media: [
10 {
11 type: 'image',
12 assets: [{ url: 'https://cdn.example.com/featurex/hero.png', mimeType: 'image/png', width: 1200, height: 628 }]
13 }
14 ],
15 links: [{ url: 'https://status.example.com/feature-x', title: 'Live Status' }]
16} as unknown) as CreateFeedPostParams;
17
18const broadcastId: string = 'broadcast_2025_11_22';
19const isLive: boolean = false;
20const doSpamCheck: boolean = true;
21const skipDupCheck: boolean = false;
22
23const result: CreateFeedPost200Response = await createFeedPost(tenantId, createFeedPostParams, broadcastId, isLive, doSpamCheck, skipDupCheck);
24

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_001';
3const createFeedPostParams: CreateFeedPostParams = {
4 title: 'Introducing the new inline editor',
5 body: 'Today we launched an editor that supports markdown, drag-and-drop images, and live preview.',
6 authorId: 'user_4521',
7 isPublished: true,
8 tags: ['product','launch','editor'],
9 media: [
10 {
11 type: 'image',
12 assets: [
13 { url: 'https://cdn.acme.com/images/editor-preview.png', mimeType: 'image/png', width: 1200, height: 800 }
14 ]
15 }
16 ],
17 links: [{ url: 'https://acme.com/blog/editor-release', title: 'Read the full release notes' }]
18};
19const broadcastId: string = 'broadcast_weekly_2025_11';
20const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example_signature';
21const response: CreateFeedPostPublic200Response = await createFeedPostPublic(tenantId, createFeedPostParams, broadcastId, sso);
22

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_acme_2025';
3const postId: string = 'post_9f8a7b6c';
4const broadcastId: string = 'broadcast_us_east_01';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakeSignature';
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_acme_01';
3const afterId: string | undefined = 'post_20251120_001';
4const tags: string[] = ['product-update', 'security'];
5const result: GetFeedPosts200Response = await getFeedPosts(tenantId, afterId, undefined, tags);
6console.log(result);
7

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_4f2a9b6c";
3const afterId: string = "post_20251120_8b7c";
4const limit: number = 25;
5const tags: Array<string> = ["technology", "product-release"];
6const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakepayload.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 = 'org-8421';
3const postIds: string[] = [
4 'c9a1e3f2-7b6d-4a11-9c2f-000000000001',
5 'd4b2c3a5-8e7f-4b22-9d3e-000000000002'
6];
7const statsWithoutSso: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds);
8const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0NTY3IiwiaWF0IjoxNjAwMDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
9const statsWithSso: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds, ssoToken);
10

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_8a9f3c9b';
3const postIds: string[] = ['post_4f2a1b6c', 'post_77b8c3d2'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Njc4OSIsIm5hbWUiOiJKb2huIERvZSJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
5const response: GetUserReactsPublic200Response = await getUserReactsPublic(tenantId, postIds, sso);
6console.log(response);
7

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 = 'acme-corp-tenant-47';
3const postId: string = 'post_8f3a9b2c';
4const reactBodyParams: ReactBodyParams = { reaction: 'like', userId: 'editor_42', metadata: { locale: 'en-US' } };
5const isUndo: boolean = false;
6const broadcastId: string = 'broadcast_20251122_01';
7const sso: string = 'sso_eyJ1c2VyIjoiZWRpdG9yXzQyIn0';
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-enterprises-42';
3const id: string = 'feedpost_20251122_001';
4const feedPost: FeedPost = {
5 title: 'Product roadmap update',
6 content: 'Updated roadmap including new moderation and analytics features.',
7 authorName: 'Acme Product Team',
8 isPublished: false,
9 scheduledAt: '2025-12-01T09:00:00Z', // optional scheduling parameter
10 media: [
11 {
12 type: 'image',
13 url: 'https://assets.acme.com/images/roadmap.png',
14 assets: [{ resolution: '1024x768', url: 'https://assets.acme.com/images/roadmap-1024.png' }]
15 }
16 ],
17 links: [{ title: 'Full Roadmap', url: 'https://acme.com/roadmap' }],
18 tags: ['roadmap', 'release', 'moderation']
19};
20const result: FlagCommentPublic200Response = await updateFeedPost(tenantId, id, feedPost);
21

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 = "tenant_acme_corp_01";
3const postId: string = "post_2025-11-22-001";
4const updateFeedPostParams: UpdateFeedPostParams = {
5 title: "Service Window: Brief Maintenance",
6 content: "We will perform a brief maintenance window on 2025-11-23 at 02:00 UTC. Expected downtime ~5 minutes.",
7 media: [{ id: "m_1001", type: "image", assets: [{ url: "https://cdn.acme.com/images/maintenance-banner.jpg", width: 1200, height: 300 }] }],
8 links: [{ url: "https://status.acme.com/2025-11-23", title: "Detailed status" }],
9 isPublished: true
10};
11const broadcastId: string = "broadcast_9f8b7c6d";
12const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_payload.signature";
13const result: 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
2async function demoFlagComment(): Promise<void> {
3 const tenantId: string = 'tenant_9a7c3f2b';
4 const commentId: string = 'cmt_5d8e12a4';
5 const isFlagged: boolean = true;
6 const sso: string | undefined = 'sso_tok_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
7 const result: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, isFlagged, sso);
8 console.log(result);
9}
10demoFlagComment();
11

addPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIPageData CreateAPIPageData Yes

Response

Returns: AddPageAPIResponse

Example

addPage Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_8f3b2a9c-prod";
4 const createAPIPageData: CreateAPIPageData = {
5 url: "https://acme.blog/products/fastsync-2",
6 title: "Introducing FastSync 2.0",
7 slug: "fastsync-2-0",
8 tags: ["releases", "sync", "performance"],
9 isPublic: true,
10 language: "en-US",
11 canonicalUrl: "https://acme.com/products/fastsync-2", // optional
12 metadata: { authorId: "user_42", summary: "Faster sync across devices." } // optional
13 };
14 const result: AddPageAPIResponse = await addPage(tenantId, createAPIPageData);
15 console.log((result as any).page as APIPage);
16})();
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-tenant-8421';
3const id: string = 'page-home-2024-11-22';
4const initiatedBy: string | undefined = 'ops@acme-corp.com'; // optional metadata
5const result: DeletePageAPIResponse = await deletePage(tenantId, id);
6

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 = "acme-enterprises-tenant-42";
3const urlId: string = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
4const includeArchived: boolean | undefined = undefined; // optional flag example (not required by getPageByURLId)
5const pageResponse: GetPageByURLIdAPIResponse = await getPageByURLId(tenantId, urlId);
6const page: APIPage | undefined = (pageResponse as any)?.page;
7const pageTitle: string | undefined = (page as any)?.title;
8

getPages Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetPagesAPIResponse

Example

getPages Example
Copy Copy
1
2const tenantId: string = 'acme-inc-78f9';
3const includeDrafts: boolean | undefined = undefined;
4const pageSize: number | undefined = 25;
5const pagesResponse: GetPagesAPIResponse = await getPages(tenantId);
6const pages: APIPage[] | undefined = (pagesResponse as any).pages;
7const firstPageTitle: string | undefined = pages?.[0]?.title as string | undefined;
8

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 = 'acme-tenant-01';
3const pageId: string = 'page_4f7a2b9d';
4const updateData: UpdateAPIPageData = {
5 title: 'About Acme Corporation',
6 slug: '/about',
7 isPublished: true,
8 tags: ['company', 'about'], // optional array of tags
9 metadata: { description: 'Company history and mission statement.' }, // optional nested object
10 lastEditedBy: 'j.smith@acme.com' // optional auditor field
11};
12const response: PatchPageAPIResponse = await patchPage(tenantId, pageId, updateData);
13

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
2(async () => {
3 const tenantId: string = "tenant_8a3f9b2";
4 const questionId: string | undefined = undefined;
5 const questionIds: Array<string> = ["q-2024-001", "q-2024-002"];
6 const urlId: string | undefined = "url_4f9c";
7 const timeBucket: AggregateTimeBucket = ("monthly" as unknown) as AggregateTimeBucket;
8 const startDate: Date = new Date("2025-01-01T00:00:00Z");
9 const forceRecalculate: boolean = true;
10 const result: AggregateQuestionResults200Response = await aggregateQuestionResults(
11 tenantId,
12 questionId,
13 questionIds,
14 urlId,
15 timeBucket,
16 startDate,
17 forceRecalculate
18 );
19 console.log(result);
20})();
21

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_prod_84b2";
4 const bulkAggregateQuestionResultsRequest: BulkAggregateQuestionResultsRequest = {
5 questionIds: ["q_9fa1b2", "q_3c4d5e"],
6 startDate: "2025-10-01T00:00:00Z",
7 endDate: "2025-10-31T23:59:59Z",
8 groupBy: "question",
9 timeBucket: "day"
10 };
11 const forceRecalculate: boolean = true;
12 const result: BulkAggregateQuestionResults200Response = await bulkAggregateQuestionResults(tenantId, bulkAggregateQuestionResultsRequest, forceRecalculate);
13 console.log(result);
14})();
15

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 = 'acme-publisher-01';
3const questionIds: string[] = ['q_7f3a2b', 'q_9b1c4d'];
4const urlId: string = 'article-2025-11-22';
5const startDate: Date = new Date('2025-01-01T00:00:00Z');
6const forceRecalculate: boolean = true;
7const minValue: number = 0;
8const maxValue: number = 5;
9const limit: number = 100;
10const result: CombineCommentsWithQuestionResults200Response = await combineCommentsWithQuestionResults({
11 tenantId,
12 questionIds,
13 urlId,
14 startDate,
15 forceRecalculate,
16 minValue,
17 maxValue,
18 limit
19});
20

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 createData: CreateAPISSOUserData = {
4 externalId: 'google-oauth2|112233445566778899',
5 email: 'emma.jones@acme-corp.com',
6 displayName: 'Emma Jones',
7 roles: ['moderator'], // optional field included
8 isAdmin: false,
9 avatarUrl: 'https://cdn.acme-corp.com/avatars/emma.jpg',
10 metadata: { department: 'product', locale: 'en-US' } // optional metadata
11} as CreateAPISSOUserData;
12const result: AddSSOUserAPIResponse = await addSSOUser(tenantId, createData);
13

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 = 'tenant_84b2f1e';
3const id: string = 'ssouser_5a9c3d2';
4const deleteComments: boolean = true;
5const commentDeleteMode: string = 'permanent';
6const response: 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
2const tenantId: string = 'tenant_9b7f2c';
3const email: string = 'jane.doe@acme-corp.com';
4const response: GetSSOUserByEmailAPIResponse = await getSSOUserByEmail(tenantId, email);
5const user: APISSOUser | undefined = (response as unknown as { user?: APISSOUser }).user;
6const emailVerified: boolean | undefined = user?.emailVerified;
7

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 = 'acme-corp-tenant-9a8b';
3const userId: string = 'user_73f2b6';
4const sessionSegment: string | undefined = undefined; // optional segment appended when present
5const effectiveId: string = sessionSegment ? `${userId}:${sessionSegment}` : userId;
6const result: GetSSOUserByIdAPIResponse = await getSSOUserById(tenantId, effectiveId);
7

getSSOUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetSSOUsers200Response

Example

getSSOUsers Example
Copy Copy
1
2const tenantId: string = 'tenant_7f8b3c4d-01';
3const skip: number = 50;
4const usersFirstPage: GetSSOUsers200Response = await getSSOUsers(tenantId);
5const usersSecondPage: GetSSOUsers200Response = await getSSOUsers(tenantId, skip);
6

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_001';
3const id: string = 'user_7842b';
4const updateAPISSOUserData: UpdateAPISSOUserData = {
5 email: 'jane.doe@acmecorp.com',
6 displayName: 'Jane Doe',
7 externalId: 'acme|jdoe',
8 roles: ['editor'],
9 metadata: { team: 'Growth' }
10};
11const updateComments: boolean = true;
12const result: PatchSSOUserAPIResponse = await patchSSOUser(tenantId, id, updateAPISSOUserData, updateComments);
13

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-9b3f2a';
3const id: string = 'sso-user-7f1c2d';
4const updateData: UpdateAPISSOUserData = {
5 externalId: 'auth0|6032b1a7',
6 email: 'jane.doe@acme.com',
7 displayName: 'Jane Doe',
8 avatarUrl: 'https://cdn.acme.com/avatars/jane.jpg',
9 roles: ['moderator'],
10 metadata: { team: 'Platform', location: 'NYC' }
11};
12const updateComments: boolean = true;
13const result: PutSSOUserAPIResponse = await putSSOUser(tenantId, id, updateData, updateComments);
14

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 = 'acme-corp-tenant-4f3e2b1a';
3const createData: CreateAPIUserSubscriptionData = {
4 userId: 'user_987654',
5 planId: 'pro_monthly',
6 paymentMethodId: 'pm_1Hh2K4Lx',
7 startDate: '2025-12-01T00:00:00Z',
8 trialDays: 14,
9 metadata: { campaign: 'black_friday_2025' }
10} as CreateAPIUserSubscriptionData;
11const result: CreateSubscriptionAPIResponse = await createSubscription(tenantId, createData);
12

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 = "acme-enterprises-123";
4 const subscriptionId: string = "sub_8f2b4c9d";
5 const userId: string = "user_42b7a";
6 const responseWithUser: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId, userId);
7 const responseWithoutUser: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId);
8})();
9

getSubscriptions Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No

Response

Returns: GetSubscriptionsAPIResponse

Example

getSubscriptions Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_acme_01";
4 const userId: string = "user_jdoe_42";
5 const allSubscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId);
6 const userSubscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId, userId);
7 console.log(allSubscriptions, userSubscriptions);
8})();
9

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-84b9f3c2";
3const imageData: Uint8Array = new Uint8Array([255,216,255,224,0,16,74,70,73,70]);
4const file: Blob = new Blob([imageData], { type: "image/jpeg" });
5const sizePreset: SizePreset = { name: "medium", maxWidth: 1024, maxHeight: 768 };
6const urlId: string = "products/blue-widget-2025/hero-image";
7const uploadResult: UploadImageResponse = await uploadImage(tenantId, file, sizePreset, urlId);
8const uploadResultMinimal: UploadImageResponse = await uploadImage(tenantId, file);
9

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-enterprise-84a1";
3const id: string = "user-9f2c1a7b";
4const fieldsToInclude: string[] | undefined = ["progress", "milestones"]; // optional parameters example
5const badgeProgress: GetUserBadgeProgressById200Response = await getUserBadgeProgressById(tenantId, id);
6

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 = 'acme-corp-2025';
3const userId: string = 'user_72a9e4b8';
4const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressByUserId(tenantId, userId);
5const badgeProgress: UserBadgeProgress | undefined = (result as any)?.badgeProgress;
6const apiStatus: APIStatus | undefined = (result as any)?.status;
7const includeDetails?: boolean = true;
8

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 = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
3const userId: string = 'user-8d7b2a9c';
4const limit: number = 25;
5const skip: number = 0;
6
7const badgeProgress: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId, userId, limit, skip);
8const badgeProgressMinimal: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId);
9

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 = "fastcomments_tenant_01";
3const createUserBadgeParams: CreateUserBadgeParams = {
4 name: "Community Helper",
5 description: "Awarded for consistently helpful and constructive replies",
6 iconUrl: "https://assets.examplecdn.com/badges/community-helper.svg",
7 // optional parameters
8 criteria: { type: "comment_count", threshold: 100 },
9 active: true,
10 customConfig: { color: "#1e90ff", highlight: true }
11};
12const result: CreateUserBadge200Response = await createUserBadge(tenantId, createUserBadgeParams);
13

deleteUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: UpdateUserBadge200Response

Example

deleteUserBadge Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-inc-7a1b2c';
4 const optionalBadgeId: string | undefined = 'badge_9f3e1'; // could be undefined to use fallback
5 const id: string = optionalBadgeId ?? 'badge_default_0001';
6 const result: UpdateUserBadge200Response = await deleteUserBadge(tenantId, id);
7 console.log(result);
8})();
9

getUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadge200Response

Example

getUserBadge Example
Copy Copy
1
2const tenantId: string = 'acmecorp-prod-01';
3const userId: string = 'usr_78a9b2c4';
4const result: GetUserBadge200Response = await getUserBadge(tenantId, userId);
5const options: { includeDetails?: boolean } = { includeDetails: true };
6const badgeName: string | undefined = (result as any)?.userBadge?.name;
7if (options.includeDetails) {
8 const badgeDescription: string | undefined = (result as any)?.userBadge?.description;
9 void badgeDescription;
10}
11

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_9b3a2c';
3const userId: string = 'user_5821';
4const badgeId: string | undefined = undefined;
5const type: number | undefined = 2;
6const displayedOnComments: boolean | undefined = true;
7const limit: number | undefined = 25;
8const skip: number | undefined = 0;
9const badges: 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_9k2h7a";
3const id: string = "badge_01F8ZC7";
4const updateUserBadgeParams: UpdateUserBadgeParams = {
5 name: "Helpful Contributor",
6 description: "Awarded for 100 helpful comments",
7 iconUrl: "https://cdn.fastcomments.com/badges/helpful.png",
8 enabled: true,
9 expiresAt: "2026-12-31T23:59:59Z" // optional parameter
10} as UpdateUserBadgeParams;
11const result: UpdateUserBadge200Response = await updateUserBadge(tenantId, id, updateUserBadgeParams);
12

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 = 'fastcomments-tenant-42';
3const ssoToken: string = 'sso:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example';
4const notificationsWithoutSSO: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId);
5const notificationsWithSSO: 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_7f4b2a1c';
3const pageSize: number = 25;
4const afterId: string | undefined = undefined;
5const includeContext: boolean = true;
6const afterCreatedAt: number | undefined = Date.now() - 7 * 24 * 60 * 60 * 1000;
7const unreadOnly: boolean = true;
8const dmOnly: boolean = false;
9const noDm: boolean | undefined = undefined;
10const includeTranslations: boolean = true;
11const sso: string | undefined = 'sso_jwt_eyJhbGci';
12const response: GetUserNotifications200Response = await getUserNotifications(
13 tenantId,
14 pageSize,
15 afterId,
16 includeContext,
17 afterCreatedAt,
18 unreadOnly,
19 dmOnly,
20 noDm,
21 includeTranslations,
22 sso
23);
24

resetUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotificationCount Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_9b3a2d';
3const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyQGFjbWUuY29tIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
4const resetResponse: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId);
5const resetResponseWithSso: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId, ssoToken);
6

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_8f2d3c';
3const afterId: string | undefined = 'notif_5b7a1e';
4const afterCreatedAt: number | undefined = Date.now() - 2 * 60 * 60 * 1000;
5const unreadOnly: boolean | undefined = true;
6const dmOnly: boolean | undefined = false;
7const noDm: boolean | undefined = undefined;
8const sso: string | undefined = 'sso_user_24a9';
9
10const result: ResetUserNotifications200Response = await resetUserNotifications(
11 tenantId,
12 afterId,
13 afterCreatedAt,
14 unreadOnly,
15 dmOnly,
16 noDm,
17 sso
18);
19

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
2const tenantId: string = "tenant_9f1b2c";
3const notificationId: string = "notification_1024";
4const optedInOrOut: UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum = UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum.OptedIn;
5const commentId: string = "cmt_20251122_abcd";
6const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_payload.signature";
7
8const result: UpdateUserNotificationStatus200Response = await updateUserNotificationCommentSubscriptionStatus(
9 tenantId,
10 notificationId,
11 optedInOrOut,
12 commentId,
13 sso
14);
15

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
2const tenantId: string = 'tenant_9f4c2b1a';
3const urlId: string = 'article-2025-11-22-fastcomments';
4const url: string = 'https://blog.example.com/2025/11/fastcomments-tutorial';
5const pageTitle: string = 'FastComments Integration Guide';
6const subscribedOrUnsubscribed: UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum = UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum.Subscribed;
7const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakeSignature';
8const response: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, subscribedOrUnsubscribed, sso);
9

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
2const tenantId: string = "acme-tenant-42";
3const notificationId: string = "notif-2025-11-22-7a3b";
4const newStatus: UpdateUserNotificationStatusNewStatusEnum = UpdateUserNotificationStatusNewStatusEnum.Read;
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
6const result: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(tenantId, notificationId, newStatus, sso);
7

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 = 'acme-corp-tenant-1';
3const urlIdWS: string = 'wss://realtime.fastcomments.com/ws/site-acme';
4const optionalExtraUserId: string | undefined = 'user_789'; // optional
5const userIds: string = ['user_123', 'user_456', ...(optionalExtraUserId ? [optionalExtraUserId] : [])].join(',');
6const presenceStatuses: GetUserPresenceStatuses200Response = await getUserPresenceStatuses(tenantId, urlIdWS, userIds);
7presenceStatuses;
8

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_acme_corp";
3const urlId: string = "news/2025/11/22/site-launch";
4const usernameStartsWith: string = "jo";
5const mentionGroupIds: Array<string> = ["senior-editors", "community-moderators"];
6const sso: string = "sso_session_9f8e7d6c5b4a3";
7const result: 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.