Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Feat/add twitter tool#63

Open
jojomensah89 wants to merge 9 commits intocovalenthq:mainfrom
jojomensah89:feat/add-twitter-tool
Open

Feat/add twitter tool#63
jojomensah89 wants to merge 9 commits intocovalenthq:mainfrom
jojomensah89:feat/add-twitter-tool

Conversation

@jojomensah89
Copy link

@jojomensah89 jojomensah89 commented Feb 6, 2025

Add Twitter Tool to AI Agent SDK

Overview

This pull request introduces a new Twitter tool to the AI Agent SDK, enabling agents to interact with Twitter (X) programmatically.

Features

  • Implement Twitter tool with support for key operations:
    • Retrieve account details
    • Post tweets
    • Reply to tweets

Technical Implementation

  • Created Zod schemas for validating Twitter-related operations
  • Integrated Twitter API v2 for robust interaction
  • Added type-safe parameter validation

Prerequisites

  • Requires Twitter API credentials:
    • TWITTER_API_KEY
    • TWITTER_API_SECRET
    • TWITTER_ACCESS_TOKEN
    • TWITTER_ACCESS_TOKEN_SECRET

Twitter API Setup

  1. Visit the Twitter (X) Developer Portal
  2. Create a new project and application
  3. Configure application settings:
    • Set "App permissions" to "Read and write"
    • Choose "Web App, Automated app or Bot"
    • Configure App info URLs

API Keys Required

You'll need the following API keys:

  • OpenAI API Key
  • Twitter (X) API Keys:
    • API Key
    • API Secret
    • Access Token
    • Access Token Secret

Configuration

  1. Copy .env.example to .env
  2. Fill in the following environment variables:
    OPENAI_API_KEY=your_openai_api_key
    TWITTER_API_KEY=your_twitter_api_key
    TWITTER_API_SECRET=your_twitter_api_secret
    TWITTER_ACCESS_TOKEN=your_twitter_access_token
    TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret
    

Example Interactions

  • "Generate and post an Ethereum joke"
  • "Check my Twitter account details"
  • "Post a tweet about the latest blockchain trend"

Troubleshooting

  • Ensure all API keys are correctly set in the .env file
  • Check network connectivity
  • Verify Twitter API permissions

Potential Use Cases

  • Social media monitoring
  • Automated tweet generation
  • Account interaction and analysis

Next Steps

  • Add more comprehensive error handling
  • Expand Twitter operation capabilities
  • Create detailed documentation for tool usage

Example twitter post by agent
ai-agent-sdk - Windsurf - index ts 2_8_2025 9_52_14 PM
jojomensah eth 🧑🏽‍💻 (@jojomensah89) _ X - Google Chrome 2_8_2025 11_23_15 PM

@gane5h
Copy link
Contributor

gane5h commented Feb 6, 2025

🔥🔥🔥

Taking a look now!

@jojomensah89
Copy link
Author

🔥🔥🔥

Taking a look now!

Still making changes
Feel free to make suggestions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants