POST /2/dm_conversations

POST /2/dm_conversations

Creates a new group conversation and adds a Direct Message to it on behalf of an authenticated user.

Endpoint URL

https://api.twitter.com/2/dm_conversations

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 1.0a is also available for this endpoint.

 

OAuth 2.0 Authorization Code with PKCE (Recommended)

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

dm.write

dm.read

tweet.read

users.read

Learn more about OAuth 2.0 Authorization Code with PKCE

JSON body parameters

Name Type Description
conversation_type
 Required 
string The conversation_type attribute must be set to "Group" (case sensitive).

Example: {"conversation_type": "Group"}
message
 Required 
object A JSON object that contains either or both the text and attachments parameters.

Example: {"message": {text": "Hello just you conversation participants!"}}
participant_ids
 Required 
array An array of User IDs that the conversation is created with. Conversations can have up to 50 participants.

Example: {"participant_ids": ["944480690","906948460078698496"]}
message.attachments
 Optional 
array A single Media ID being attached to the Direct Message. This field is required if message.text is not present. For this launch, only 1 attachment is supported.

Example: {"message": {"text": "Sending a DM with media!", "attachments": [{"media_id": "1455952740635586573"}]}
message.text
 Optional 
string Text of the Direct Message being created. This field is required if message.attachment is not present. Text messages support up to 10,000 characters.

Example: {"message": {"text": "Hello just you conversation participants!"}}



Example commands

cURL
      curl -X POST "https://api.twitter.com/2/dm_conversations" -d '{"conversation_type":"Group", "participant_ids": ["944480690", "906948460078698496"],"message": {"text": "Hello to you two, this is a new group conversation"}}' -H "Authorization: Bearer $ACCESS_TOKEN"
    

Example responses

Successful response
      {
  "dm_conversation_id": "1346889436626259968",
  "dm_event_id": "128341038123"
}
    

Response fields

NameTypeDescription
dm_conversation_idstringContains id of the DM conversation.
dm_event_idstringContains id of the event sent in this conversation.