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

Constructors

constructor

• new DirectMessagesClient(client): DirectMessagesClient Creates a new direct messages client instance

Parameters

Returns

DirectMessagesClient

Defined in

direct_messages/client.ts:340

Methods

createByConversationId

▸ createByConversationId(dmConversationId, options): Promise<Response> Create DM message by conversation ID Sends a new direct message to a specific conversation by its ID.

Parameters

Returns

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

Defined in

direct_messages/client.ts:385 ▸ createByConversationId(dmConversationId, options?): Promise<CreateDmEventResponse>

Parameters

Returns

Promise<CreateDmEventResponse>

Defined in

direct_messages/client.ts:398

getEventsByConversationId

▸ getEventsByConversationId(id, options): Promise<Response> Get DM events for a DM conversation Retrieves direct message events for a specific conversation.

Parameters

Returns

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

Defined in

direct_messages/client.ts:506 ▸ getEventsByConversationId(id, options?): Promise<Get2DmConversationsIdDmEventsResponse>

Parameters

Returns

Promise<Get2DmConversationsIdDmEventsResponse>

Defined in

direct_messages/client.ts:519

createConversation

▸ createConversation(options): Promise<Response> Create DM conversation Initiates a new direct message conversation with specified participants.

Parameters

Returns

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

Defined in

direct_messages/client.ts:784 ▸ createConversation(options?): Promise<CreateDmEventResponse>

Parameters

Returns

Promise<CreateDmEventResponse>

Defined in

direct_messages/client.ts:793

getEventsByParticipantId

▸ getEventsByParticipantId(participantId, options): Promise<Response> Get DM events for a DM conversation Retrieves direct message events for a specific conversation.

Parameters

Returns

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

Defined in

direct_messages/client.ts:889 ▸ getEventsByParticipantId(participantId, options?): Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>

Parameters

Returns

Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>

Defined in

direct_messages/client.ts:902

getEvents

▸ getEvents(options): Promise<Response> Get DM events Retrieves a list of recent direct message events across all conversations.

Parameters

Returns

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

Defined in

direct_messages/client.ts:1167 ▸ getEvents(options?): Promise<Get2DmEventsResponse>

Parameters

Returns

Promise<Get2DmEventsResponse>

Defined in

direct_messages/client.ts:1176

getEventsById

▸ getEventsById(eventId, options): Promise<Response> Get DM event by ID Retrieves details of a specific direct message event by its ID.

Parameters

Returns

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

Defined in

direct_messages/client.ts:1433 ▸ getEventsById(eventId, options?): Promise<Get2DmEventsEventIdResponse>

Parameters

Returns

Promise<Get2DmEventsEventIdResponse>

Defined in

direct_messages/client.ts:1446

deleteEvents

▸ deleteEvents(eventId, options): Promise<Response> Delete DM event Deletes a specific direct message event by its ID, if owned by the authenticated user.

Parameters

Returns

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

Defined in

direct_messages/client.ts:1656 ▸ deleteEvents(eventId): Promise<DeleteDmResponse>

Parameters

Returns

Promise<DeleteDmResponse>

Defined in

direct_messages/client.ts:1669

createByParticipantId

▸ createByParticipantId(participantId, options): Promise<Response> Create DM message by participant ID Sends a new direct message to a specific participant by their ID.

Parameters

Returns

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

Defined in

direct_messages/client.ts:1760 ▸ createByParticipantId(participantId, options?): Promise<CreateDmEventResponse>

Parameters

Returns

Promise<CreateDmEventResponse>

Defined in

direct_messages/client.ts:1773