Comparing v1.1 and v2 Direct Message event lookup endpoints
Both v1.1 and v2 versions of the Direct Messages endpoints provide methods for looking up Direct Message events. This guide is intended to help understand the differences and provide information for migrating to v2. A major difference between the two versions is that v1.1 supports only one-to-one conversations, while v2 introduces support for group conversations. One artifact of this is that v1.1 supports only “message created” events, while v2 also supports events associated with participants joining and leaving conversations. In fact, a fundamental v2 update is establishing dm_conversations as a core API object. With v1.1. there are two endpoints for retrieving Direct Messages (again, new messages are the only event type supported with v1.1):- GET direct_messages/events/show - Retrieves a single event by ID.
- GET direct_messages/events/list - Retrieves up to 30 days of one-to-one Direct Messages sent and received by the authenticated user. Note that this method is not able to retrieve messages from group conversations.
- GET /2/dm_conversations/with/:participant_id/dm_events - Retrieves Direct Message events associated with a one-to-one conversation. The :participant_id path parameter is the User ID of the account having the conversation with the authenticated user making this request.
- GET /2/dm_conversations/:dm_conversation_id/dm_events - Retrieves Direct Message events associated with a specific conversation ID, as indicated by the :dm_conversation_id path parameter. This method supports both one-to-one and group conversations.
- GET /2/dm_events - Retrieves Direct Message events associated with a user, including both one-to-one and group conversations. Events from up to 30 days ago are available.
The following tables compare the v2 GET methods with version v1.1. Note that these v2 offerings expand the available capabilities by supporting group conversations.
**Get all messages in a specific one-to-one conversation **
Path: GET /2/dm_conversations/with/:participant_id/dm_events
**Get all messages by conversation ID **
Path: GET /2/dm_conversations/:dm_conversation_id/dm_events
Get all events across an authenticated user’s conversations, both one-to-one and group conversations
Path: GET /2/dm_events