Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Latest commit

 

History

History
55 lines (42 loc) · 1.46 KB

File metadata and controls

55 lines (42 loc) · 1.46 KB

CDP Agentkit Twitter Langchain Extension Examples - Chatbot

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 Web3 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 Node Version

Before using the example, ensure that you have the correct version of Node.js installed. The example requires Node.js 18 or higher. You can check your Node version by running:

node --version
npm --version

Installation

npm install

Run the Chatbot

Ensure the following vars are set in .env:

  • "OPENAI_API_KEY"
  • "TWITTER_ACCESS_TOKEN"
  • "TWITTER_ACCESS_TOKEN_SECRET"
  • "TWITTER_API_KEY"
  • "TWITTER_API_SECRET"
npm start