|
| 1 | +# Twitter Client Configuration Guide |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | +- Twitter Developer Account |
| 5 | +- Twitter API Access (User Authentication Tokens) |
| 6 | +- Basic understanding of environment variables |
| 7 | + |
| 8 | +## Required Credentials |
| 9 | +The following Twitter API credentials are required: |
| 10 | + |
| 11 | +```env |
| 12 | +TWITTER_USERNAME=your_twitter_username |
| 13 | +TWITTER_PASSWORD=your_twitter_password |
| 14 | +TWITTER_EMAIL=your_twitter_email |
| 15 | +TWITTER_API_KEY=your_api_key |
| 16 | +TWITTER_API_SECRET=your_api_secret |
| 17 | +TWITTER_ACCESS_TOKEN=your_access_token |
| 18 | +TWITTER_ACCESS_SECRET=your_access_token_secret |
| 19 | +TWITTER_BEARER_TOKEN=your_bearer_token |
| 20 | +``` |
| 21 | + |
| 22 | +## Optional Configuration Settings |
| 23 | +Additional settings to customize behavior: |
| 24 | + |
| 25 | +```env |
| 26 | +# Tweet Length Configuration |
| 27 | +MAX_TWEET_LENGTH=280 # Maximum length for tweets |
| 28 | +
|
| 29 | +# Search and Monitoring |
| 30 | +TWITTER_SEARCH_ENABLE=true # Enable/disable tweet searching |
| 31 | +TWITTER_TARGET_USERS=user1,user2 # Comma-separated list of users to monitor |
| 32 | +
|
| 33 | +# Posting Configuration |
| 34 | +POST_INTERVAL_MIN=90 # Minimum minutes between posts |
| 35 | +POST_INTERVAL_MAX=180 # Maximum minutes between posts |
| 36 | +POST_IMMEDIATELY=false # Post immediately on startup |
| 37 | +
|
| 38 | +# Action Processing |
| 39 | +ENABLE_ACTION_PROCESSING=true # Enable processing of likes/retweets |
| 40 | +ACTION_INTERVAL=5 # Minutes between action processing |
| 41 | +TWITTER_POLL_INTERVAL=120 # Seconds between checking for new tweets |
| 42 | +
|
| 43 | +# Authentication |
| 44 | +TWITTER_2FA_SECRET= # If using 2FA |
| 45 | +TWITTER_RETRY_LIMIT=5 # Number of login retry attempts |
| 46 | +
|
| 47 | +# Testing |
| 48 | +TWITTER_DRY_RUN=false # Test mode without actual posting |
| 49 | +``` |
| 50 | + |
| 51 | +## Character File Configuration |
| 52 | +Character files (`.character.json`) should include Twitter-specific settings: |
| 53 | + |
| 54 | +```json |
| 55 | +{ |
| 56 | + "settings": { |
| 57 | + "twitter": { |
| 58 | + "monitor": { |
| 59 | + "keywords": ["keyword1", "keyword2"], |
| 60 | + "imageUrls": ["url1", "url2"], |
| 61 | + "imageRotationInterval": 3600, |
| 62 | + "activeTimeWindows": [ |
| 63 | + {"start": "09:00", "end": "17:00"} |
| 64 | + ], |
| 65 | + "postInterval": 7200, |
| 66 | + "pollInterval": 300 |
| 67 | + } |
| 68 | + } |
| 69 | + }, |
| 70 | + "topics": [ |
| 71 | + "topic1", |
| 72 | + "topic2" |
| 73 | + ] |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Setup Instructions |
| 78 | + |
| 79 | +1. **Create Twitter Developer Account** |
| 80 | + - Visit developer.twitter.com |
| 81 | + - Create a new project and app |
| 82 | + - Enable User Authentication |
| 83 | + - Generate API keys and tokens |
| 84 | + |
| 85 | +2. **Configure Environment Variables** |
| 86 | + - Copy `.env.example` to `.env` |
| 87 | + - Fill in all required credentials |
| 88 | + - Adjust optional settings as needed |
| 89 | + |
| 90 | +3. **Configure Character File** |
| 91 | + - Add Twitter monitoring settings |
| 92 | + - Define relevant topics and keywords |
| 93 | + - Set appropriate time windows and intervals |
| 94 | + |
| 95 | +4. **Verify Configuration** |
| 96 | + - Run with `TWITTER_DRY_RUN=true` initially |
| 97 | + - Check logs for proper authentication |
| 98 | + - Test basic functionality before enabling full features |
| 99 | + |
| 100 | +## Features |
| 101 | +- Photo posting support |
| 102 | +- Keyword-based retweeting |
| 103 | +- Automated liking based on topics |
| 104 | +- User-level authentication |
| 105 | +- Configurable posting intervals |
| 106 | +- Smart conversation threading |
| 107 | + |
| 108 | +## Troubleshooting |
| 109 | + |
| 110 | +### Common Issues |
| 111 | +1. Authentication Failures |
| 112 | + - Verify all credentials are correct |
| 113 | + - Check if API keys have proper permissions |
| 114 | + - Ensure 2FA is properly configured if enabled |
| 115 | + |
| 116 | +2. Rate Limiting |
| 117 | + - Adjust intervals to be more conservative |
| 118 | + - Monitor Twitter API usage |
| 119 | + - Check rate limit headers in responses |
| 120 | + |
| 121 | +3. Content Issues |
| 122 | + - Verify MAX_TWEET_LENGTH setting |
| 123 | + - Check character file topic configuration |
| 124 | + - Ensure media uploads are properly formatted |
| 125 | + |
| 126 | +## Security Notes |
| 127 | +- Keep all API credentials secure |
| 128 | +- Don't commit `.env` file to version control |
| 129 | +- Regularly rotate access tokens |
| 130 | +- Use environment variables over hardcoded values |
0 commit comments