Example
To create the TwitterHandler object, initialize it with your Twitter API credentials. The handler uses Tweepy’s AsyncClient to interact with the Twitter API.Posts a tweet with optional hashtags, user mentions, and a shortened link.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import os
from superagentx_handlers.twitter import TwitterHandler
twitter_handler = TwitterHandler(
api_key=os.getenv("CONSUMER_KEY"),
api_secret_key=os.getenv("CONSUMER_SECRET"),
access_token=os.getenv("ACCESS_TOKEN"),
access_token_secret=os.getenv("ACCESS_TOKEN_SECRET")
)
response = await twitter_handler.post_tweet(
text="Launching our new AI feature!",
link="https://example.com/product",
hash_tags=["AI", "MachineLearning"],
user_tags=["openai"]
)
print(response)
