Tools
Prerequisites
The following example requires the tweepy
library.
Get a Twitter API key and secret from here.
Example
The following agent will use Twitter to get information about a user, send a message to a user, and create a new tweet.
cookbook/tools/twitter_tools.py
Toolkit Params
Parameter | Type | Default | Description |
---|---|---|---|
bearer_token | str | None | The bearer token for Twitter API authentication |
consumer_key | str | None | The consumer key for Twitter API authentication |
consumer_secret | str | None | The consumer secret for Twitter API authentication |
access_token | str | None | The access token for Twitter API authentication |
access_token_secret | str | None | The access token secret for Twitter API authentication |
Toolkit Functions
Function | Description |
---|---|
create_tweet | Creates and posts a new tweet |
reply_to_tweet | Replies to an existing tweet |
send_dm | Sends a direct message to a Twitter user |
get_user_info | Retrieves information about a Twitter user |
get_home_timeline | Gets the authenticated user’s home timeline |
Information
- View on Github