Skip to main content
Client for account activity operations This client provides methods for interacting with the account activity endpoints of the X API. It handles authentication, request formatting, and response parsing for all account activity related operations.

Constructors

constructor

new AccountActivityClient(client): AccountActivityClient Creates a new account activity client instance

Parameters

NameTypeDescription
clientClientThe main X API client instance

Returns

AccountActivityClient

Defined in

account_activity/client.ts:70

Methods

getSubscriptions

getSubscriptions(webhookId, options): Promise<Response> Get subscriptions Retrieves a list of all active subscriptions for a given webhook.

Parameters

NameTypeDescription
webhookIdstringThe webhook ID to pull subscriptions for.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:115 getSubscriptions(webhookId): Promise<SubscriptionsListGetResponse>

Parameters

NameType
webhookIdstring

Returns

Promise<SubscriptionsListGetResponse>

Defined in

account_activity/client.ts:128

deleteSubscription

deleteSubscription(webhookId, userId, options): Promise<Response> Delete subscription Deletes an Account Activity subscription for the given webhook and user ID.

Parameters

NameTypeDescription
webhookIdstringThe webhook ID to check subscription against.
userIdstringUser ID to unsubscribe from.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:217 deleteSubscription(webhookId, userId): Promise<SubscriptionsDeleteResponse>

Parameters

NameType
webhookIdstring
userIdstring

Returns

Promise<SubscriptionsDeleteResponse>

Defined in

account_activity/client.ts:234

validateSubscription

validateSubscription(webhookId, options): Promise<Response> Validate subscription Checks a user’s Account Activity subscription for a given webhook.

Parameters

NameTypeDescription
webhookIdstringThe webhook ID to check subscription against.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:331 validateSubscription(webhookId): Promise<SubscriptionsGetResponse>

Parameters

NameType
webhookIdstring

Returns

Promise<SubscriptionsGetResponse>

Defined in

account_activity/client.ts:344

createSubscription

createSubscription(webhookId, options): Promise<Response> Create subscription Creates an Account Activity subscription for the user and the given webhook.

Parameters

NameTypeDescription
webhookIdstringThe webhook ID to check subscription against.
optionsCreateSubscriptionOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:435 createSubscription(webhookId, options?): Promise<SubscriptionsCreateResponse>

Parameters

NameType
webhookIdstring
options?CreateSubscriptionOptions

Returns

Promise<SubscriptionsCreateResponse>

Defined in

account_activity/client.ts:448

createReplayJob

createReplayJob(webhookId, fromDate, toDate, options): Promise<Response> Create replay job Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.

Parameters

NameTypeDescription
webhookIdstringThe unique identifier for the webhook configuration.
fromDatestringThe oldest (starting) UTC timestamp (inclusive) from which events will be provided, in yyyymmddhhmm format.
toDatestringThe latest (ending) UTC timestamp (exclusive) up to which events will be provided, in yyyymmddhhmm format.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:564 createReplayJob(webhookId, fromDate, toDate): Promise<ReplayJobCreateResponse>

Parameters

NameType
webhookIdstring
fromDatestring
toDatestring

Returns

Promise<ReplayJobCreateResponse>

Defined in

account_activity/client.ts:585

getSubscriptionCount

getSubscriptionCount(options): Promise<Response> Get subscription count Retrieves a count of currently active Account Activity subscriptions.

Parameters

NameType
optionsObject
options.requestOptionsObject
options.requestOptions.rawtrue

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

account_activity/client.ts:704 getSubscriptionCount(): Promise<SubscriptionsCountGetResponse>

Returns

Promise<SubscriptionsCountGetResponse>

Defined in

account_activity/client.ts:713