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:211Methods
getEvents
▸ getEvents(options?): Promise<Get2DmEventsResponse>
Get DM events
Retrieves a list of recent direct message events across all conversations.
Parameters
| Name | Type | 
|---|---|
options | GetEventsOptions | 
Returns
Promise<Get2DmEventsResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:224getEventsByParticipantId
▸ getEventsByParticipantId(participantId, options?): Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>
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 | - | 
Returns
Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:311createByConversationId
▸ createByConversationId(dmConversationId, options?): Promise<CreateDmEventResponse>
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 | - | 
Returns
Promise<CreateDmEventResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:406createByParticipantId
▸ createByParticipantId(participantId, options?): Promise<CreateDmEventResponse>
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 | - | 
Returns
Promise<CreateDmEventResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:457getEventsByConversationId
▸ getEventsByConversationId(id, options?): Promise<Get2DmConversationsIdDmEventsResponse>
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 | - | 
Returns
Promise<Get2DmConversationsIdDmEventsResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:508getEventsById
▸ getEventsById(eventId, options?): Promise<Get2DmEventsEventIdResponse>
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 | - | 
Returns
Promise<Get2DmEventsEventIdResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:600deleteEvents
▸ deleteEvents(eventId): Promise<DeleteDmResponse>
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. | 
Returns
Promise<DeleteDmResponse>
Promise resolving to the API response
Defined in
direct_messages/client.ts:674createConversation
▸ createConversation(options?): Promise<CreateDmEventResponse>
Create DM conversation
Initiates a new direct message conversation with specified participants.
Parameters
| Name | Type | 
|---|---|
options | CreateConversationOptions | 
Returns
Promise<CreateDmEventResponse>
Promise resolving to the API response