Skip to content

feat(x): add 28 new X API v2 tool integrations and expand OAuth scopes#3365

Merged
waleedlatif1 merged 11 commits intostagingfrom
waleedlatif1/x-twitter-tools
Feb 27, 2026
Merged

feat(x): add 28 new X API v2 tool integrations and expand OAuth scopes#3365
waleedlatif1 merged 11 commits intostagingfrom
waleedlatif1/x-twitter-tools

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add 28 new X (Twitter) API v2 tools: search tweets, user tweets/mentions/timeline, bookmarks (CRUD), tweet create/delete, get me, search users, followers/following, manage follow/block/like/retweet/mute, hide reply, trends, usage, and more
  • Expand OAuth scopes to cover all new endpoints (bookmarks, likes, follows, blocks, mutes, tweet moderation)
  • Register all new tools in the tool registry
  • Add full type definitions for all new tool params and responses

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 27, 2026 6:29am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR significantly expands X (Twitter) API integration by adding 28 new tools covering tweets, bookmarks, engagement (likes/retweets), user relationships (follow/block/mute), trends, and usage monitoring. All tools follow a consistent implementation pattern with proper error handling, logging, and type safety.

Key Changes:

  • Added comprehensive X API v2 tool suite (28 new tools)
  • Expanded OAuth scopes to support all new endpoints
  • Implemented proper error handling with logger in all tools
  • Added complete type definitions with snake_case to camelCase transformers
  • Registered all tools in the global registry
  • Updated block UI configuration with proper field mappings

Code Quality:

  • All tools include error handling with logger.error() calls
  • Pagination support properly implemented (nextToken/paginationToken)
  • Type definitions are comprehensive and consistent
  • Action-based tools (manage_like, manage_follow, etc.) use dynamic URLs and HTTP methods
  • Response transformers handle null/undefined values gracefully

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects thorough implementation with consistent patterns, proper error handling throughout, comprehensive type safety, and successful resolution of all previously identified issues
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/x.ts Added comprehensive block config for 28 new X API v2 operations with proper field mappings and action parameter transformations
apps/sim/lib/oauth/oauth.ts Expanded X OAuth scopes from 4 to 14 scopes to cover bookmarks, likes, follows, blocks, mutes, and tweet moderation
apps/sim/tools/x/types.ts Added comprehensive type definitions for all 28 new tools with proper transformation functions for tweets, users, and trends
apps/sim/tools/registry.ts Registered all 28 new X API v2 tools in the tool registry with proper imports
apps/sim/tools/x/create_tweet.ts Implements tweet creation with reply, quote, media, and reply settings support; includes proper error handling
apps/sim/tools/x/search_tweets.ts Implements tweet search with full pagination support including nextToken, advanced filters, and comprehensive error handling
apps/sim/tools/x/get_bookmarks.ts Implements bookmark retrieval with pagination and proper error handling
apps/sim/tools/x/manage_follow.ts Implements follow/unfollow actions with dynamic URL and method based on action parameter
apps/sim/tools/x/get_usage.ts Retrieves API usage statistics with daily breakdown and proper null handling

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User Selects X Block Operation] --> B{Operation Type}
    
    B -->|Tweet Ops| C[create_tweet/delete_tweet/search_tweets]
    B -->|Bookmarks| D[get_bookmarks/create_bookmark/delete_bookmark]
    B -->|Engagement| E[manage_like/manage_retweet]
    B -->|Social| F[manage_follow/manage_block/manage_mute]
    B -->|Timeline| G[get_user_tweets/mentions/timeline]
    B -->|Trends| H[get_trends_by_woeid/personalized_trends]
    B -->|Analytics| I[get_usage]
    
    C --> J[Build Request with Params]
    D --> J
    E --> J
    F --> J
    G --> J
    H --> J
    I --> J
    
    J --> K[Add OAuth Token from Credential]
    K --> L[Execute X API v2 Request]
    
    L --> M{Response Status}
    M -->|Success| N[Transform Response snake_case to camelCase]
    M -->|Error| O[Log Error with Logger]
    
    N --> P[Return Typed Output]
    O --> Q[Return Error with Empty Output]
    
    style L fill:#1DA1F2
    style N fill:#90EE90
    style O fill:#FFB6C1
Loading

Last reviewed commit: 95fbcb2

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

33 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

1 similar comment
@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 9233d4e into staging Feb 27, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/x-twitter-tools branch February 27, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant