Skip to main content

ReactionsClient

Client for interacting with Twist reaction endpoints.

Extends

  • BaseClient

Constructors

Constructor

new ReactionsClient(config: ClientConfig): ReactionsClient;

Parameters

ParameterType
configClientConfig

Returns

ReactionsClient

Inherited from

BaseClient.constructor

Properties

PropertyModifierType
apiTokenreadonlystring
baseUrl?readonlystring
customFetch?readonlyCustomFetch
defaultVersionreadonly"v3" | "v4"

Methods

add()

Call Signature

add(args: AddReactionArgs, options: {
batch: true;
}): BatchRequestDescriptor<void>;

Adds an emoji reaction to a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsAddReactionArgsThe arguments for adding a reaction.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<void>

Example
await api.reactions.add({ threadId: 789, reaction: '👍' })

// Batch usage
const batch = api.createBatch()
batch.add(() => api.reactions.add({ threadId: 789, reaction: '👍' }, { batch: true }))

Call Signature

add(args: AddReactionArgs, options?: {
batch?: false;
}): Promise<void>;

Adds an emoji reaction to a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsAddReactionArgsThe arguments for adding a reaction.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<void>

Example
await api.reactions.add({ threadId: 789, reaction: '👍' })

// Batch usage
const batch = api.createBatch()
batch.add(() => api.reactions.add({ threadId: 789, reaction: '👍' }, { batch: true }))

get()

Call Signature

get(args: GetReactionsArgs, options: {
batch: true;
}): BatchRequestDescriptor<ReactionObject>;

Gets reactions for a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsGetReactionsArgsThe arguments for getting reactions.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<ReactionObject>

A reaction object with emoji reactions as keys and arrays of user IDs as values, or null if no reactions.

Example
const reactions = await api.reactions.get({ threadId: 789 })
// Returns: { "👍": [1, 2, 3], "❤️": [4, 5] }

Call Signature

get(args: GetReactionsArgs, options?: {
batch?: false;
}): Promise<ReactionObject>;

Gets reactions for a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsGetReactionsArgsThe arguments for getting reactions.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<ReactionObject>

A reaction object with emoji reactions as keys and arrays of user IDs as values, or null if no reactions.

Example
const reactions = await api.reactions.get({ threadId: 789 })
// Returns: { "👍": [1, 2, 3], "❤️": [4, 5] }

getBaseUri()

protected getBaseUri(version?: "v3" | "v4"): string;

Gets the base URI for API requests with proper trailing slash handling. This method fixes the trailing slash bug that occurred when using custom baseUrl.

Parameters

ParameterTypeDescription
version?"v3" | "v4"Optional API version override. Defaults to the configured version or 'v3'

Returns

string

Base URI with guaranteed trailing slash for proper URL resolution

Inherited from

BaseClient.getBaseUri

remove()

Call Signature

remove(args: RemoveReactionArgs, options: {
batch: true;
}): BatchRequestDescriptor<void>;

Removes an emoji reaction from a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsRemoveReactionArgsThe arguments for removing a reaction.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<void>

Example
await api.reactions.remove({ threadId: 789, reaction: '👍' })

Call Signature

remove(args: RemoveReactionArgs, options?: {
batch?: false;
}): Promise<void>;

Removes an emoji reaction from a thread, comment, or conversation message.

Parameters
ParameterTypeDescription
argsRemoveReactionArgsThe arguments for removing a reaction.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<void>

Example
await api.reactions.remove({ threadId: 789, reaction: '👍' })