Skip to content

Commit ffe501b

Browse files
authored
Documentation edits made through Mintlify web editor
1 parent 43eba37 commit ffe501b

1 file changed

Lines changed: 44 additions & 46 deletions

File tree

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
---
2-
title: Introduction
3-
sidebarTitle: Introduction
4-
---
5-
6-
import { Button } from '/snippets/button.mdx';
7-
8-
Only available to those with [Pro and Enterprise access](/x-api/getting-started/about-x-api)
9-
10-
Direct Messages enable private conversations on X. Direct Messages are one of the most popular features of X, with a wide variety of use cases. These use cases range from group chats among friends, to powering customer support for brands around the world. New v2 versions of Direct Messages endpoints will be introduced in stages, and this first stage includes fundamental endpoints for creating Direct Messages and listing Direct Message conversation events. For the first time, the X API v2 supports _group_ conversations.
11-
12-
This initial release of Manage Direct Messages includes three POST methods for creating Direct Messages:
13-
14-
* **POST /2/dm\_conversations/with/:participant\_id/messages** \- Creates a one-to-one Direct Message. This method either creates a new 1-1 conversation or retrieves the current conversation and adds the Direct Message to it. The :participant_idpath parameter is the User ID of the account receiving the message. 
15-
* **POST /2/dm_conversations** \- Creates a new group conversation and adds a Direct Message to it. These requests require a list of conversation participants. Note that you can create multiple conversations with the same participant list. These requests will always return a new conversation ID. 
16-
* **POST /2/dm\_conversations/:dm\_conversation_id/messages** - Creates a Direct Message and adds it to an existing conversation. The :dm\_conversation\_id path parameter is the ID of the conversation that the message will be added to. 
17-
18-
Note that Direct Message event IDs are common across the v1.1 and v2 (as well as the X App), so the v1.1 methods to hide/delete Direct Messages can be used along with this new v2 endpoint. Also note that the Enterprise and Premium Account Activity APIs support v2 one-to-one messages, but do not yet support group conversations.   
19-
20-
There is a user rate limit of 200 requests per 15 minutes for the POST method. There is also a rate limit of 1000 requests per 24 hours per user. Additionally, there is a rate limit of 15000 requests per 24 hours. Note that these rate limits are shared across these POST endpoints.
21-
22-
Since you are making requests on behalf of a user with the manage Posts endpoints, you must authenticate with either [OAuth 1.0a User Context](https://developer-staging.x.com/resources/fundamentals/authentication)or [OAuth 2.0 Authorization Code with PKCE](resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2), and use a user Access Tokens associated with a user that has authorized your App. To generate this user Access Token with OAuth 1.0a, you can use the [3-legged OAuth flow](/resources/fundamentals/authentication#using-and-generating-an-app-only-bearer-token). To generate a user Access Token with OAuth 2.0, you can use the [Authorization Code with PKCE grant flow](/resources/fundamentals/authentication#how-to-connect-to-endpoints-using-oauth-2-0-authorization-code-flow-with-pkce)).
23-
<Note>
24-
**Account setup**
25-
26-
To access these endpoints, you will need:
27-
28-
* An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info).
29-
* To authenticate using the keys and tokens from a [developer App](/resources/fundamentals/developer-apps) that is located within a [Project](/resources/fundamentals/projects)
30-
31-
Learn more about getting access to the X API v2 endpoints in our [getting started guide](/x-api/getting-started/getting-access).
32-
</Note>
33-
<div className="flex space-x-2">
34-
<Button href="/x-api/direct-messages/manage/quickstart">
35-
Quick start
36-
</Button>
37-
<Button href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
38-
Sample code
39-
</Button>
40-
<Button href="https://app.getpostman.com/run-collection/9956214-784efcda-ed4c-4491-a4c0-a26470a67400">
41-
Run in Postman
42-
</Button>
43-
<Button href="https://developer.x.com/apitools/api?endpoint=/2/tweets&method=post">
44-
Try with API Explorer
45-
</Button>
46-
</div>
1+
---
2+
title: Introduction
3+
sidebarTitle: Introduction
4+
---
5+
6+
import { Button } from '/snippets/button.mdx';
7+
8+
Direct Messages enable private conversations on X. Direct Messages are one of the most popular features of X, with a wide variety of use cases. These use cases range from group chats among friends, to powering customer support for brands around the world. New v2 versions of Direct Messages endpoints will be introduced in stages, and this first stage includes fundamental endpoints for creating Direct Messages and listing Direct Message conversation events. For the first time, the X API v2 supports _group_ conversations.
9+
10+
This initial release of Manage Direct Messages includes three POST methods for creating Direct Messages:
11+
12+
* **POST /2/dm\_conversations/with/:participant\_id/messages** \- Creates a one-to-one Direct Message. This method either creates a new 1-1 conversation or retrieves the current conversation and adds the Direct Message to it. The :participant_idpath parameter is the User ID of the account receiving the message. 
13+
* **POST /2/dm_conversations** \- Creates a new group conversation and adds a Direct Message to it. These requests require a list of conversation participants. Note that you can create multiple conversations with the same participant list. These requests will always return a new conversation ID. 
14+
* **POST /2/dm\_conversations/:dm\_conversation_id/messages** - Creates a Direct Message and adds it to an existing conversation. The :dm\_conversation\_id path parameter is the ID of the conversation that the message will be added to. 
15+
16+
Note that Direct Message event IDs are common across the v1.1 and v2 (as well as the X App), so the v1.1 methods to hide/delete Direct Messages can be used along with this new v2 endpoint. Also note that the Enterprise and Premium Account Activity APIs support v2 one-to-one messages, but do not yet support group conversations.   
17+
18+
There is a user rate limit of 200 requests per 15 minutes for the POST method. There is also a rate limit of 1000 requests per 24 hours per user. Additionally, there is a rate limit of 15000 requests per 24 hours. Note that these rate limits are shared across these POST endpoints.
19+
20+
Since you are making requests on behalf of a user with the manage Posts endpoints, you must authenticate with either [OAuth 1.0a User Context](https://developer-staging.x.com/resources/fundamentals/authentication)or [OAuth 2.0 Authorization Code with PKCE](resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2), and use a user Access Tokens associated with a user that has authorized your App. To generate this user Access Token with OAuth 1.0a, you can use the [3-legged OAuth flow](/resources/fundamentals/authentication#using-and-generating-an-app-only-bearer-token). To generate a user Access Token with OAuth 2.0, you can use the [Authorization Code with PKCE grant flow](/resources/fundamentals/authentication#how-to-connect-to-endpoints-using-oauth-2-0-authorization-code-flow-with-pkce)).
21+
<Note>
22+
**Account setup**
23+
24+
To access these endpoints, you will need:
25+
26+
* An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info).
27+
* To authenticate using the keys and tokens from a [developer App](/resources/fundamentals/developer-apps) that is located within a [Project](/resources/fundamentals/projects)
28+
29+
Learn more about getting access to the X API v2 endpoints in our [getting started guide](/x-api/getting-started/getting-access).
30+
</Note>
31+
<div className="flex space-x-2">
32+
<Button href="/x-api/direct-messages/manage/quickstart">
33+
Quick start
34+
</Button>
35+
<Button href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
36+
Sample code
37+
</Button>
38+
<Button href="https://app.getpostman.com/run-collection/9956214-784efcda-ed4c-4491-a4c0-a26470a67400">
39+
Run in Postman
40+
</Button>
41+
<Button href="https://developer.x.com/apitools/api?endpoint=/2/tweets&method=post">
42+
Try with API Explorer
43+
</Button>
44+
</div>

0 commit comments

Comments
 (0)