PrerequisitesBefore you begin, you’ll need:
- A developer account with an approved App
- User Access Token (OAuth 2.0 PKCE with
dm.writeanddm.readscopes)
Send a one-to-one message
1
Get the recipient's user ID
You need the user ID of the person you want to message. You can get this from the User lookup endpoint.
2
Send the message
cURL
3
Review the response
Create a group conversation
1
Define participants
Gather the user IDs of everyone you want in the group (excluding yourself).
2
Create the group with first message
cURL
3
Receive the conversation ID
dm_conversation_id to add more messages later.Add a message to an existing conversation
Send a message to a conversation you’re already part of:cURL
Send a message with media
1
Upload the media
First, upload your media using the Media Upload endpoint.
2
Send with media attachment
cURL
Delete a message
Delete a message you sent:cURL
Required scopes
When using OAuth 2.0 PKCE, your access token must have these scopes:| Scope | Description |
|---|---|
dm.write | Send and delete messages |
dm.read | Read conversations (required with dm.write) |
tweet.read | Required for some expansions |
users.read | Required for user expansions |