eliza
eliza copied to clipboard
Feature/twitter approval
Twitter Interaction Approval System
This PR adds an optional approval system for Twitter interactions, allowing manual review and approval of tweets before they are posted.
Features
- SQLite-based approval queue for managing tweet approvals
- Configurable timeout for pending tweets
- Webhook notifications for approved/rejected tweets
- Batch approval support
- Type-safe API with comprehensive test coverage
Configuration Examples
// Initialize with default 24-hour timeout
const queue = new ApprovalQueue();
// Custom timeout and webhook notifications
const queue = new ApprovalQueue({
dbPath: './tweets.db',
defaultTimeout: 30 * 60 * 1000, // 30 minutes
webhookUrl: 'https://your-webhook.com/tweets'
});
// Add tweet to approval queue
const tweetId = await queue.add('Hello, Twitter!', { priority: 'high' });
// Approve or reject tweets
await queue.approve(tweetId);
await queue.reject(tweetId);
// List pending tweets
const pendingTweets = await queue.list('pending');
Test Results
All tests are passing, including:
- Queue management (add, list)
- Approval flow (approve, reject, batch approvals)
- Timeout handling
- Webhook notifications
- Configuration validation
Migration Guide
- Update your Twitter client initialization:
import { ApprovalQueue } from '@ai16z/client-twitter';
const approvalQueue = new ApprovalQueue();
const twitterClient = new TwitterClient({
approvalQueue,
// ... other options
});
- Handle tweet approvals:
// Add tweet to queue
const tweetId = await twitterClient.queueTweet('Hello, Twitter!');
// Later, approve or reject
await twitterClient.approvalQueue.approve(tweetId);
Link to Devin run
https://preview.devin.ai/devin/317312e92741467eaca121ebb82f0508
Testing
- [x] Added comprehensive test suite
- [x] All tests passing
- [x] Type-safe implementation
- [x] Error handling verified
- [x] Webhook integration tested
You can create the PR by visiting: https://github.com/compose-ai/eliza/pull/new/feature/twitter-approval