lookupEventsWith abstract method

Future<TwitterResponse<List<DMEventData>, DMEventMeta>> lookupEventsWith({
  1. required String participantId,
  2. List<DMEventType>? eventTypes,
  3. int? maxResults,
  4. String? paginationToken,
  5. List<DMEventExpansion>? expansions,
  6. List<TweetField>? tweetFields,
  7. List<UserField>? userFields,
  8. List<MediaField>? mediaFields,
  9. List<DMEventField>? dmEventFields,
  10. Paging<List<DMEventData>, DMEventMeta>? paging,
})

Returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participantId path parameter.

Messages are returned in reverse chronological order.

Parameters

  • participantId: The participant id of the user that the authenticating user is having a 1-1 conversation with.

  • eventTypes: The type of Direct Message event to return. If not included, all types are returned.

  • maxResults: The maximum number of results to be returned in a page. Must be between 1 and 100. The default is 100.

  • paginationToken: Contains either the next_token or previous_token value.

  • expansions: Expansions enable you to request additional data objects that relate to the returned Direct Message conversation events. The IDs that represents the expanded data objects will be included directly in the event data object, and the expanded object metadata will be returned within the includes response object.

  • tweetFields: This fields parameter enables you to select which specific Tweet fields will be delivered in each returned Direct Message 'MessageCreate' event object that contains a Tweet reference. While the Tweet ID will be in the event object, you will find this ID and all additional Tweet fields in the includes data object.

  • userFields: This fields parameter enables you to select which specific user fields will be delivered for Direct Message conversation events that reference a sender or participant ID. While the user ID will be located in the event object, you will find this ID and all additional user fields in the includes data object.

  • mediaFields: This fields parameter enables you to select which specific media fields will be delivered in Direct Message MessageCreate events. While the media ID will be located in the event object, you will find this ID and all additional media fields in the includes data object. The event object will only include media fields if the Direct Message contains media and if you've also included the expansions=attachments.media_keys query parameter in your request.

  • dmEventFields: Extra fields to include in the event payload. id, and event_type are returned by default. The text value isn't included for ParticipantsJoin and ParticipantsLeave events.

  • paging: If this callback function is specified, paging is performed continuously until certain conditions are met. This paging function is bi-directional, both forward and backward, and allows for safe paging. The response and other metadata obtained when paging is performed is passed to the callback function as PagingEvent object. So you can get the result of paging from PagingEvent object. Also, the direction and continuity of paging can be controlled by returning PaginationControl object in the paging callback function. Please use PaginationControl.forward() to continue paging and move forward, or use PaginationControl.backward() to move backward. And be sure to return PaginationControl.stop() to terminate paging on arbitrary conditions, otherwise paging continues until the next page runs out.

Endpoint Url

Authentication Methods

  • OAuth 2.0 Authorization Code with PKCE
  • OAuth 1.0a

Required Scopes

  • tweet.read
  • users.read
  • dm.read

Rate Limits

  • User rate limit (User context): 300 requests per 15-minute window per each authenticated user.

Reference

Implementation

Future<TwitterResponse<List<DMEventData>, DMEventMeta>> lookupEventsWith({
  required String participantId,
  List<DMEventType>? eventTypes,
  int? maxResults,
  String? paginationToken,
  List<DMEventExpansion>? expansions,
  List<TweetField>? tweetFields,
  List<UserField>? userFields,
  List<MediaField>? mediaFields,
  List<DMEventField>? dmEventFields,
  Paging<List<DMEventData>, DMEventMeta>? paging,
});