|
| 1 | +# openadapt-crier |
| 2 | + |
| 3 | +Event-driven social media approval bot with Telegram. |
| 4 | + |
| 5 | +## How it works |
| 6 | + |
| 7 | +Crier watches GitHub repositories for new commits, releases, and merged PRs. When activity is detected, it uses an LLM (Claude) to score how interesting the event is. Events that pass the interest threshold get platform-specific draft posts generated automatically. Drafts are sent to a Telegram bot for human review, where you can approve, edit, or reject them. On approval, posts are dispatched to Discord, Twitter/X, and LinkedIn via [openadapt-herald](https://github.com/OpenAdaptAI/openadapt-herald). |
| 8 | + |
| 9 | +``` |
| 10 | +GitHub Events ──> Watcher ──> Drafter (LLM) ──> Telegram Bot ──> Dispatcher ──> Herald ──> Social Platforms |
| 11 | + (commits, (polls (scores (approve, (posts to (publish) (Discord, |
| 12 | + releases, GitHub interest, edit, or selected Twitter, |
| 13 | + merged PRs) API) generates reject) platforms) LinkedIn) |
| 14 | + drafts) |
| 15 | +``` |
| 16 | + |
| 17 | +## Quick start |
| 18 | + |
| 19 | +```bash |
| 20 | +pip install . |
| 21 | + |
| 22 | +# Required env vars |
| 23 | +export CRIER_TELEGRAM_BOT_TOKEN="your-telegram-bot-token" |
| 24 | +export CRIER_TELEGRAM_OWNER_ID="your-telegram-user-id" |
| 25 | +export CRIER_REPOS="owner/repo1,owner/repo2" |
| 26 | +export ANTHROPIC_API_KEY="your-anthropic-key" |
| 27 | + |
| 28 | +# Optional: platform credentials for posting |
| 29 | +export DISCORD_WEBHOOK_URL="..." |
| 30 | +export TWITTER_CONSUMER_KEY="..." |
| 31 | +export TWITTER_CONSUMER_SECRET="..." |
| 32 | +export TWITTER_ACCESS_TOKEN="..." |
| 33 | +export TWITTER_ACCESS_TOKEN_SECRET="..." |
| 34 | +export LINKEDIN_ACCESS_TOKEN="..." |
| 35 | + |
| 36 | +# Start the bot |
| 37 | +crier run |
| 38 | +``` |
| 39 | + |
| 40 | +## CLI commands |
| 41 | + |
| 42 | +| Command | Description | |
| 43 | +|---------|-------------| |
| 44 | +| `crier run` | Start the bot and watcher loop (runs forever) | |
| 45 | +| `crier status` | Show bot status and configuration summary | |
| 46 | +| `crier draft <owner/repo>` | Generate a one-shot draft for a repo (no Telegram, no posting) | |
| 47 | +| `crier drafts` | List recent drafts, with optional `--status` and `--platform` filters | |
| 48 | +| `crier history` | Show posting history | |
| 49 | + |
| 50 | +## Configuration |
| 51 | + |
| 52 | +All settings can be set via `CRIER_`-prefixed environment variables or a `.env` file: |
| 53 | + |
| 54 | +| Variable | Description | Default | |
| 55 | +|----------|-------------|---------| |
| 56 | +| `CRIER_TELEGRAM_BOT_TOKEN` | Telegram bot token | (required) | |
| 57 | +| `CRIER_TELEGRAM_OWNER_ID` | Telegram user ID for approvals | (required) | |
| 58 | +| `CRIER_REPOS` | Comma-separated `owner/repo` list | (required) | |
| 59 | +| `CRIER_GITHUB_TOKEN` | GitHub API token (higher rate limits) | `$GH_TOKEN` | |
| 60 | +| `CRIER_ANTHROPIC_API_KEY` | Anthropic API key | `$ANTHROPIC_API_KEY` | |
| 61 | +| `CRIER_POLL_INTERVAL` | Seconds between polls | `60` | |
| 62 | +| `CRIER_INTEREST_THRESHOLD` | Minimum score (0-10) to generate drafts | `5.0` | |
| 63 | +| `CRIER_DRY_RUN` | Skip actual posting | `false` | |
| 64 | + |
| 65 | +## Telegram bot commands |
| 66 | + |
| 67 | +Once the bot is running, these commands are available in Telegram: |
| 68 | + |
| 69 | +- `/start` -- Show help |
| 70 | +- `/status` -- Bot status and pending draft count |
| 71 | +- `/history` -- Recent posting history |
| 72 | +- `/draft <owner/repo>` -- Manually trigger a draft |
| 73 | + |
| 74 | +Draft messages include inline buttons to **Approve**, **Edit**, or **Reject**, plus per-platform toggles (Twitter, Discord, LinkedIn). |
| 75 | + |
| 76 | +## Tests |
| 77 | + |
| 78 | +132 tests covering all modules: |
| 79 | + |
| 80 | +```bash |
| 81 | +pip install ".[dev]" |
| 82 | +pytest |
| 83 | +``` |
| 84 | + |
| 85 | +## License |
| 86 | + |
| 87 | +MIT -- see [LICENSE](LICENSE). |
0 commit comments