Skip to content

feat: add X (Twitter) API to growth agent#3285

Closed
la14-1 wants to merge 1 commit intomainfrom
feat/x-growth-api
Closed

feat: add X (Twitter) API to growth agent#3285
la14-1 wants to merge 1 commit intomainfrom
feat/x-growth-api

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Apr 13, 2026

Summary

  • Adds X (Twitter) as a second discovery platform for the growth agent alongside Reddit
  • X API v2 pay-per-use search (~$0.30/day, ~$9/month budget with 3 queries x 20 results)
  • Same Slack approval flow: platform-labeled candidate cards with approve/edit/skip buttons
  • Reply posting routes to Reddit comment or X tweet reply based on candidate platform

New files

  • x-fetch.ts — X API batch fetcher with Bearer token auth, author expansions for bio/follower data
  • x-reply.sh — OAuth 1.0a tweet reply script (HMAC-SHA1 signing via bun crypto)

Modified files

  • growth.sh — Phase 1b: optional X fetch when X_BEARER_TOKEN is set, merges both platform datasets
  • growth-prompt.md — Multi-platform scoring prompt with X-specific qualification signals
  • trigger-server.tsPOST /x-reply endpoint for tweet replies
  • helpers.tsplatform column in candidates DB (with migration for existing DBs)
  • main.ts — Platform-aware candidate cards, reply routing to Reddit or X
  • spa.test.ts — Updated test helper with platform field

Env vars needed

Var Purpose
X_BEARER_TOKEN X API v2 app-only read access (search)
X_API_KEY OAuth 1.0a consumer key (for posting replies)
X_API_SECRET OAuth 1.0a consumer secret
X_ACCESS_TOKEN OAuth 1.0a access token
X_ACCESS_SECRET OAuth 1.0a access token secret

Test plan

  • bash -n passes on all .sh files
  • bun test — 2104 tests pass (0 failures)
  • SPA tests — 100 pass (including candidate DB round-trip with platform field)
  • Biome lint — 0 errors
  • Manual: run growth cycle with X_BEARER_TOKEN set, verify X posts appear in merged output
  • Manual: verify Slack card shows "X Growth" header for X candidates
  • Manual: approve X candidate, verify tweet reply is posted

🤖 Generated with Claude Code

Add X as a second discovery platform alongside Reddit. The growth agent
now fetches from both platforms, scores candidates with the same Claude
pipeline, and routes approved replies to the correct platform.

New files:
- x-fetch.ts: X API v2 search fetcher (3 queries x 20 results, ~$0.30/day)
- x-reply.sh: OAuth 1.0a tweet reply script

Changes:
- growth.sh: Phase 1b fetches X posts when X_BEARER_TOKEN is set, merges
  with Reddit data before Claude scoring
- growth-prompt.md: Multi-platform scoring prompt with platform-specific
  qualification signals
- trigger-server.ts: POST /x-reply endpoint for tweet replies
- SPA helpers.ts: platform column in candidates DB, migration for existing DBs
- SPA main.ts: platform-aware candidate cards ("X Growth" vs "Reddit Growth"),
  routes approve/edit to correct reply endpoint
- spa.test.ts: add platform field to test helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@la14-1
Copy link
Copy Markdown
Member Author

la14-1 commented Apr 13, 2026

This feature request targets files in .claude/skills/setup-agent-team/ (growth agent infrastructure), which is outside the scope of automated refactoring. The new files (x-fetch.ts, x-reply.ts, etc.) and modifications to growth.sh all live in that directory. This needs manual review and implementation by a maintainer.

-- refactor/community-coordinator

@la14-1 la14-1 added the needs-human-review Issue needs human review before automated processing label Apr 13, 2026
@louisgv louisgv closed this Apr 15, 2026
@louisgv louisgv deleted the feat/x-growth-api branch April 15, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human-review Issue needs human review before automated processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants