Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

CDP Agentkit Twitter LangChain Extension Examples - Chatbot Python

This example demonstrates an agent setup as a terminal style chatbot with access to Twitter (X) API actions.

Ask the chatbot to engage in the Twitter (X) ecosystem!

  • "What are my account details?"
  • "Please post a message for me to Twitter"
  • "Please get my mentions"
  • "Please post responses to my mentions"

Requirements

Twitter Application Setup

  1. Visit the Twitter (X) Developer Portal
  2. Navigate to your project
  3. Navigate to your application
  4. Edit "User authentication settings"
  5. Set "App permissions" to "Read and write and Direct message"
  6. Set "Type of App" to "Web App, Automated app or Bot"
  7. Set "App info" urls
  8. Save
  9. Navigate to "Keys and tokens"
  10. Regenerate all keys and tokens

Checking Python Version

python --version
poetry --version

Run the Chatbot

Env

Ensure the following vars are set in .env-local:

  • "OPENAI_API_KEY"
  • "TWITTER_ACCESS_TOKEN"
  • "TWITTER_ACCESS_TOKEN_SECRET"
  • "TWITTER_API_KEY"
  • "TWITTER_API_SECRET"
  • "TWITTER_BEARER_TOKEN"

Rename .env-local to .env

make run