-
Notifications
You must be signed in to change notification settings - Fork 38
X bubble #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Suggested PR title from PearlTitle: Body: This PR delivers a robust, TypeScript-first X (Twitter) integration, enabling a suite of powerful operations:
Built on a Secure, Developer-First Foundation: True to Bubble Lab's commitment to transparency and developer ownership, this integration is built with:
This integration aligns perfectly with our mission to provide an open, transparent, and developer-first platform for agentic workflows. Now, you can seamlessly connect your Bubble Lab automations to the pulse of social media, from automated content publishing to real-time data analysis. We believe this will unlock a new realm of possibilities for our community to build something truly great! 🚀 🚀 "Build in Public" Social Media ContentGoogle Doc Created: View Document Suggested X Post: #BuildInPublic #OpenSource #BubbleLab #Developers Suggested LinkedIn Post: No more manual tweeting or complex external scripts! With this integration, you can now:
True to our #DeveloperFirst commitment, this integration is built on a robust foundation: This isn't just a new feature; it's a statement of principles. We believe the future of agentic systems is being written in #TypeScript, and this integration perfectly aligns with our mission to provide an open, transparent, and developer-first platform. It unlocks a whole new realm of possibilities for our community to build something truly great! What kind of innovative X (Twitter) workflows are you excited to build? Let us know in the comments! 👇 #BubbleLab #AI #Workflows #Automation #XIntegration #TwitterAPI #OpenSource #BuildInPublic #TypeScript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds X (Twitter) integration to the BubbleLab system, enabling users to authenticate with X OAuth 2.0 and perform operations like posting tweets, retrieving tweets, and getting user information.
- Adds X Twitter OAuth 2.0 support with PKCE authentication
- Implements
XTwitterBubbleservice with four operations: post_tweet, get_tweet, get_user_info, and get_user_tweets - Updates schema definitions, credential configurations, and UI components to support X Twitter
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bubble-shared-schemas/src/types.ts | Adds X_TWITTER_CRED credential type and 'x-twitter' bubble name |
| packages/bubble-shared-schemas/src/credential-schema.ts | Configures OAuth provider for X with PKCE support and default scopes |
| packages/bubble-core/src/bubbles/service-bubble/x-twitter.ts | Implements XTwitterBubble class with four Twitter API operations |
| packages/bubble-core/src/bubble-factory.ts | Registers XTwitterBubble in the factory |
| apps/bubblelab-api/src/services/oauth-service.ts | Adds X OAuth 2.0 client with PKCE code verifier generation and token exchange |
| apps/bubblelab-api/src/config/env.ts | Adds X_OAUTH_CLIENT_ID and X_OAUTH_CLIENT_SECRET environment variables |
| apps/bubble-studio/src/pages/CredentialsPage.tsx | Adds UI configuration for X Twitter credentials |
| apps/bubble-studio/src/lib/integrations.ts | Adds X Twitter logo mappings and documentation aliases |
| operation: z.literal('post_tweet').describe('Post a new tweet'), | ||
| success: z.boolean().describe('Whether the tweet was posted successfully'), | ||
| tweet: TweetSchema.optional().describe('Posted tweet metadata'), | ||
| error: z.string().describe('Error message if operation failed'), |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error field in all result schemas should be .optional() since it's only present when success is false. Currently it's marked as required which means successful responses must provide an empty string for error, which is redundant.
| type XTwitterResult = z.output<typeof XTwitterResultSchema>; | ||
| type XTwitterParams = z.input<typeof XTwitterParamsSchema>; | ||
|
|
||
| // Helper type to get the result type for a specific operation |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exported helper type lacks documentation. Add a JSDoc comment explaining its purpose for extracting operation-specific result types.
| // Helper type to get the result type for a specific operation | |
| /** | |
| * Helper type to extract the result type for a specific X Twitter operation. | |
| * Given an operation name, returns the corresponding result type from XTwitterResult. | |
| */ |
| private async makeTwitterApiRequest( | ||
| endpoint: string, | ||
| method: 'GET' | 'POST' = 'GET', | ||
| body?: any | ||
| ): Promise<any> { |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of any for both the body parameter and return type reduces type safety. Consider using generic types or more specific type definitions for API request/response bodies.
| if (provider === 'x') { | ||
| // Use the library's built-in PKCE code verifier generator | ||
| codeVerifier = await generateCodeVerifier(); | ||
| console.log(`Generated PKCE code_verifier for X OAuth`); |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the PKCE code_verifier generation could expose sensitive authentication flow information in production logs. This log statement should be removed or converted to a debug-level log that's disabled in production.
| console.log(`Generated PKCE code_verifier for X OAuth`); |
| if (!token.refreshToken) { | ||
| console.warn( |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refresh token warning check appears to be incomplete in the diff context. Ensure this warning is properly logged for X OAuth, as refresh tokens are critical for the 'offline.access' scope.
| }, | ||
| }, | ||
| authorizationParams: { | ||
| // X uses PKCE which is handled automatically by @badgateway/oauth2-client |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] While the comment explains PKCE is handled automatically, it would be helpful to note that X requires PKCE (not optional) unlike Google OAuth which doesn't use it.
| // X uses PKCE which is handled automatically by @badgateway/oauth2-client | |
| // X (Twitter) requires PKCE (not optional), which is handled automatically by @badgateway/oauth2-client. | |
| // Note: Google OAuth does not use PKCE. |
| - OAuth 2.0 authentication with X (Twitter) | ||
| - Scoped access permissions | ||
| - Secure token handling | ||
| `; |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The alias 'twitter' should have a comment explaining its purpose, especially since the service is branded as 'X (Twitter)' throughout the codebase.
| `; | |
| `; | |
| // Alias retained as 'twitter' for backward compatibility and user familiarity, | |
| // despite official rebranding to 'X (Twitter)' throughout the codebase. |
No description provided.