POST /2/dm_conversations/with/:participant_id/messages
Creates a one-to-one Direct Message and adds it to the one-to-one conversation. This method either creates a new one-to-one conversation or retrieves the current conversation and adds the Direct Message to it.
Endpoint URL
https://api.twitter.com/2/dm_conversations/with/:participant_id/messages
Authentication and rate limits
Authentication methods supported by this endpoint |
OAuth 2.0 Authorization Code with PKCE (Recommended) OAuth 1.0a is also available for this endpoint. |
---|---|
Rate limit | User rate limit (User context): 200 requests per 15-minute window per each authenticated user User rate limit (User context): 1000 requests per 24-hour window per each authenticated user App rate limit: 15000 requests per 24-hour window shared among the app |
OAuth 2.0 scopes required by this endpoint
|
Learn more about OAuth 2.0 Authorization Code with PKCE |
Path parameters
Name | Type | Description |
---|---|---|
participant_id Required |
string | The User ID of the account this one-to-one Direct Message is to be sent to. |
JSON body parameters
Name | Type | Description |
---|---|---|
attachments Optional |
array | A single Media ID being attached to the Direct Message. This field is required if text is not present. For this launch, only 1 attachment is supported.Example: {"text": "Sending a DM with media!", "attachments": [{"media_id": "1455952740635586573"}] |
text Optional |
string | Text of the Direct Message being created. This field is required if attachments is not present. Text messages support up to 10,000 characters.Example: {"text": "Hello just you"} |
Example commands
Example responses
Response fields
Name | Type | Description |
---|---|---|
dm_conversation_id | string | Contains the id of the Direct Message conversation the Direct Message was added to. |
dm_event_id | string | Contains the id of the event created by this request. |