CLI Reference
DroidBot is operated primarily through Python scripts, the Flask server, and pytest. This page covers all CLI entry points.
Starting the Server
Section titled “Starting the Server”python3 run.pyStarts the Flask server on http://localhost:5055 with the scheduler daemon thread, all API endpoints, and the dashboard.
For debug mode:
python3 -c "from marketing_system.server import app; app.run(host='0.0.0.0', port=5055, debug=True)"Environment Variables
Section titled “Environment Variables”| Variable | Required | Purpose |
|---|---|---|
DEVICE | If multiple phones | Default ADB serial |
KIE_AI_API_KEY | For video generation | KIE AI API key |
OPENROUTER_API_KEY | For LLM features | OpenRouter API key |
OPENAI_API_KEY | For Sora video gen | OpenAI API key |
ANTHROPIC_API_KEY | For Claude backend | Anthropic API key |
FREEIMAGE_API_KEY | For image hosting | FreeImage API key |
POSTHOG_API_KEY | For analytics | PostHog project key |
Bot Scripts
Section titled “Bot Scripts”All bot scripts are in marketing_system/bots/tiktok/ and can be run directly.
Influencer Crawling
Section titled “Influencer Crawling”# Crawl top tabpython3 -m marketing_system.bots.tiktok.scraper "#Cat" \ --tab top --date-filter "Past 24 hours" --passes 5
# Crawl users tabpython3 -m marketing_system.bots.tiktok.scraper "#Dog" \ --tab users --passes 3| Flag | Default | Description |
|---|---|---|
query | required | Hashtag to search |
--tab | top | Search tab (top, users) |
--date-filter | None | Time filter |
--passes | 3 | Scroll passes |
--sort | Relevance | Sort order |
DM Outreach
Section titled “DM Outreach”python3 -m marketing_system.bots.tiktok.outreach \ --strategy-id 1 --min-followers 10000 --delay 60 --limit 20| Flag | Default | Description |
|---|---|---|
--strategy-id | required | Message template ID |
--min-followers | 0 | Minimum followers |
--max-followers | None | Maximum followers |
--delay | 60 | Seconds between DMs |
--limit | None | Max DMs to send |
--label | None | Target label |
Video Upload
Section titled “Video Upload”# Upload as draftpython3 -m marketing_system.bots.tiktok.upload /path/to/video.mp4 \ --caption "Check this out!" --hashtags "cat,aicat" --action draft
# Upload and post immediatelypython3 -m marketing_system.bots.tiktok.upload /path/to/video.mp4 \ --caption "Amazing!" --hashtags "viral,fyp" --action post
# Upload with TTSpython3 -m marketing_system.bots.tiktok.upload /path/to/video.mp4 \ --caption "Listen!" --inject-tts --action draftPost Analytics
Section titled “Post Analytics”python3 -m marketing_system.bots.tiktok.perf_scanner --num-posts 5FYP Engagement
Section titled “FYP Engagement”python3 -m marketing_system.bots.tiktok.engage \ --duration 300 --like-pct 30 --comment-pct 5 --favorite-pct 10Inbox Scanner
Section titled “Inbox Scanner”python3 -m marketing_system.bots.tiktok.inbox_scanner --max-scrolls 10Continuous Crawling
Section titled “Continuous Crawling”python3 -m marketing_system.bots.tiktok.crawl_runnerRotates through all hashtags in the database, picking the least-recently-crawled each time.
LLM Content Planner
Section titled “LLM Content Planner”# Dry run (plan only, no generation)python3 -m marketing_system.agent.agent_core --days 3 --dry-run
# Live runpython3 -m marketing_system.agent.agent_core --days 3 --posts-per-day 3App Explorer
Section titled “App Explorer”python3 -m marketing_system.skills.auto_creator \ --package com.zhiliaoapp.musically \ --device L9AIB7603188953 \ --max-depth 3 --max-states 20 --settle 1.5| Flag | Default | Description |
|---|---|---|
--package | required | Android package name |
--device | required | ADB serial |
--max-depth | 3 | BFS depth |
--max-states | 20 | Max unique states |
--settle | 1.5 | Seconds after each tap |
--output | auto | Output directory |
Skill Execution
Section titled “Skill Execution”python3 -m marketing_system.skills._run_skill \ --skill tiktok \ --workflow engage_fyp \ --device L9AIB7603188953 \ --params '{"duration": 60}'This is what the scheduler calls internally for skill_workflow and skill_action jobs.
Running Tests
Section titled “Running Tests”# Full test suiteDEVICE=L9AIB7603188953 python3 -m pytest tests/ -v --tb=short
# Specific test filepython3 -m pytest tests/test_04_crawl.py -v
# Specific test functionpython3 -m pytest tests/test_05_outreach.py::test_send_dm -v
# On a different deviceDEVICE=RZCX125RE5L python3 -m pytest tests/ -vTest Files
Section titled “Test Files”| Test | What It Does | Requires |
|---|---|---|
test_00_baseline | Verify correct TikTok account | TikTok logged in |
test_01_accounts | Account switching | 2+ TikTok accounts |
test_02_draft | Upload video as draft | Video file |
test_03_post | Live post (skipped by default) | Video file |
test_04_crawl | Scrape by hashtag | TikTok access |
test_05_outreach | Send DMs | Target influencers |
test_06_inbox_scan | Scan inbox | DM conversations |
test_07_perf_scan | Scrape analytics | Published posts |
test_08_draft_publish | Publish a draft | Existing draft |
Related
Section titled “Related”- Installation — setup prerequisites
- API: REST Endpoints — HTTP API reference
- Scheduler — how jobs are managed