You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Direct Messages enable private conversations on Twitter. Direct Messages are one of the most popular features of Twitter, 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 Twitter API v2 supports group conversations.
4
+
5
+
You can get more information for this at [docs](https://developer.twitter.com/en/docs/twitter-api/direct-messages/lookup/introduction)
6
+
7
+
### Get all messages in a 1-1 conversation
8
+
9
+
Returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participant_id path parameter.
10
+
11
+
Messages are returned in reverse chronological order.
# Response(data=[DirectMessageEvent(id='1593091374437781510', event_type='MessageCreate', text='New group by api')])
27
+
```
28
+
29
+
### Get all messages across a user's DM conversations (both sent and received, group and 1-1 conversations)
30
+
31
+
Returns a list of Direct Messages for the authenticated user, both sent and received. Direct Message events are returned in reverse chronological order.
32
+
33
+
Supports retrieving events from the previous 30 days.
34
+
35
+
```python
36
+
my_api.get_dm_events(max_results=2)
37
+
# Response(data=[DirectMessageEvent(id='1593226454237487108', event_type='MessageCreate', text='from api to III'), DirectMessageEvent(id='1593226322066567177', event_type='MessageCreate', text='from api to III')])
Direct Messages enable private conversations on Twitter. Direct Messages are one of the most popular features of Twitter, 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 Twitter API v2 supports group conversations.
4
+
5
+
You can get more information for this at [docs](https://developer.twitter.com/en/docs/twitter-api/direct-messages/manage/introduction)
6
+
7
+
8
+
### Create a message in a 1-1 conversation with the participant
9
+
10
+
Creates a one-to-one Direct Message and adds it to the one-to-one conversation.
11
+
12
+
This method either creates a new one-to-one conversation or retrieves the current conversation and adds the Direct Message to it.
13
+
14
+
```python
15
+
my_api.create_message_to_participant("1334059193268011010", text="dm by api")
0 commit comments