feat: Integrate Twitter V2 API
Relates to:
No specific issue or ticket linked. Sister PR (client side usage of): https://github.com/ai16z/agent-twitter-client/pull/3/files
Risks
Risk Level: Medium
- Potential Impacts:
- Breaks compatibility with existing Twitter V1 API usage if misconfigured.
- Errors in authentication if API keys or tokens are invalid or not provided.
Background
What does this PR do?
This PR integrates support for the Twitter V2 API in the application while maintaining fallback compatibility with the V1 API for scenarios where V2 credentials are unavailable. Key features include:
- Authentication using V2 API keys and tokens.
- Enhanced tweet handling logic to differentiate between V1 and V2.
- Updated
.env.examplefile to include required settings for V2 API.
What kind of change is this?
- Feature: Adds functionality for Twitter V2 API integration.
Why are we doing this?
The integration of the Twitter V2 API ensures better performance, additional functionality, and alignment with the latest Twitter developer standards. Maintaining V1 as a fallback ensures backward compatibility.
Documentation changes needed?
- [x] My changes require a change to the project documentation.
- [ ] If a docs change is needed: I have updated the documentation accordingly.
Changes to .env.example and setup instructions for V2 API keys must be added to the documentation.
Testing
Where should a reviewer start?
- Review changes in
packages/client-twitter/src/*for updated API integration logic. - Validate
.env.exampleupdates for configuration changes.
Detailed testing steps
- Configure
.envwith V2 API keys and tokens. - Run the application to verify successful authentication via V2.
- Remove V2 credentials and test fallback to V1.
- Perform end-to-end tweet retrieval and posting for both V1 and V2 modes.
Screenshots
Before
N/A (No V2 integration)
After
N/A (No UI changes)
Deploy Notes
- Ensure
.envincludes both V1 and V2 API credentials. - Update deployment scripts to validate environment variables for the V2 API.
Database changes
None.
Deployment instructions
Standard deployment process; no additional steps required.
Discord username
@0x8664 for project communication and role assignment.
+2
This pull request has been automatically marked as stale due to 30 days of inactivity. If no further activity occurs within 7 days, it will be closed automatically. Please take action if this pull request is still relevant.