Documentation Index
Fetch the complete documentation index at: https://docs.x.com/llms.txt
Use this file to discover all available pages before exploring further.
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
| Name | Type | Description |
|---|
client | Client | The main X API client instance |
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
| Name | Type | Description |
|---|
dmConversationId | string | The DM Conversation ID. |
options | CreateByConversationIdOptions & { requestOptions: { raw: true } } | - |
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
| Name | Type |
|---|
dmConversationId | string |
options? | CreateByConversationIdOptions |
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
| Name | Type | Description |
|---|
id | string | The DM conversation ID. |
options | GetEventsByConversationIdOptions & { requestOptions: { raw: true } } | - |
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
| Name | Type |
|---|
id | string |
options? | GetEventsByConversationIdOptions |
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
| Name | Type |
|---|
options | CreateConversationOptions & { requestOptions: { raw: true } } |
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
| Name | Type |
|---|
options? | CreateConversationOptions |
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
| Name | Type | Description |
|---|
participantId | string | The ID of the participant user for the One to One DM conversation. |
options | GetEventsByParticipantIdOptions & { requestOptions: { raw: true } } | - |
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
| Name | Type |
|---|
participantId | string |
options? | GetEventsByParticipantIdOptions |
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
| Name | Type |
|---|
options | GetEventsOptions & { requestOptions: { raw: true } } |
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
| Name | Type |
|---|
options? | GetEventsOptions |
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
| Name | Type | Description |
|---|
eventId | string | dm event id. |
options | GetEventsByIdOptions & { requestOptions: { raw: true } } | - |
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
| Name | Type |
|---|
eventId | string |
options? | GetEventsByIdOptions |
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
| Name | Type | Description |
|---|
eventId | string | The ID of the direct-message event to delete. |
options | Object | - |
options.requestOptions | Object | - |
options.requestOptions.raw | true | - |
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
| Name | Type | Description |
|---|
participantId | string | The ID of the recipient user that will receive the DM. |
options | CreateByParticipantIdOptions & { requestOptions: { raw: true } } | - |
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
| Name | Type |
|---|
participantId | string |
options? | CreateByParticipantIdOptions |
Returns
Promise<CreateDmEventResponse>
Defined in
direct_messages/client.ts:1773