createReply method

Future<TwitterResponse<TweetData, void>> createReply({
  1. required String tweetId,
  2. required String text,
  3. String? quoteTweetId,
  4. bool? forSuperFollowersOnly,
  5. ReplySetting? replySetting,
  6. String? directMessageDeepLink,
  7. TweetMediaParam? media,
  8. TweetGeoParam? geo,
  9. TweetPollParam? poll,
  10. List<String>? excludeReplyUserIds,
})

This is a convenience method for creating a reply.

tweetId should be the ID of the tweet for which you want to create a reply. If tweetId is an empty string, an ArgumentError will always occur.

Parameters

  • tweetId: The ID of the tweet for which you want to create a reply.

  • text: Text of the Tweet being created. This field is required if media.media_ids is not present.

  • quoteTweetId: Link to the Tweet being quoted.

  • forSuperFollowersOnly: Allows you to Tweet exclusively for Super Followers.

  • replySetting: Settings to indicate who can reply to the Tweet. Options include mentionedUsers and following. The default to everyone.

  • directMessageDeepLink: Tweets a link directly to a Direct Message conversation with an account.

  • media: The object that contains media information being attached to created Tweet. This is mutually exclusive from Quote Tweet ID and Poll.

  • geo: A JSON object that contains location information for a Tweet. You can only add a location to Tweets if you have geo enabled in your profile settings. If you don't have geo enabled, you can still add a location parameter in your request body, but it won't get attached to your Tweet

  • poll: The object that contains options for a Tweet with a poll. This is mutually exclusive from Media and Quote Tweet ID.

  • reply: The object that contains information of the Tweet being replied to.

  • excludeReplyUserIds: A list of IDs of users you want to exclude from replies when you create a thread.

Endpoint Url

Authentication Methods

  • OAuth 2.0 Authorization Code with PKCE
  • OAuth 1.0a

Required Scopes

  • tweet.read
  • tweet.write
  • users.read

Rate Limits

  • User rate limit (OAuth 2.0 user Access Token): 200 requests per 15-minute window per each authenticated user

Implementation

Future<TwitterResponse<TweetData, void>> createReply({
  required String tweetId,
  required String text,
  String? quoteTweetId,
  bool? forSuperFollowersOnly,
  ReplySetting? replySetting,
  String? directMessageDeepLink,
  TweetMediaParam? media,
  TweetGeoParam? geo,
  TweetPollParam? poll,
  List<String>? excludeReplyUserIds,
}) async {
  if (tweetId.isEmpty) {
    throw ArgumentError(
      'The Tweet ID is required to create a reply.',
    );
  }

  return await createTweet(
    text: text,
    quoteTweetId: quoteTweetId,
    forSuperFollowersOnly: forSuperFollowersOnly,
    replySetting: replySetting,
    directMessageDeepLink: directMessageDeepLink,
    media: media,
    geo: geo,
    poll: poll,
    reply: TweetReplyParam(
      inReplyToTweetId: tweetId,
      excludeReplyUserIds: excludeReplyUserIds,
    ),
  );
}