Ampost CLI
By ArturPublished Updated
ampost posts to the networks you connect from a terminal, a shell script, a CI job or an AI agent. Local images and videos are uploaded for you, and --json with fixed exit codes makes it easy to script.
Install
Node 18 or later. The package installs the ampost command; npx ampost-cli runs it without installing.
terminal
npx ampost-cli --help # run it without installing
npm install -g ampost-cli # or install the `ampost` commandPublish a post
Create an API key in Settings, API keys and connect Bluesky and Threads in the dashboard. ampost login asks for the key, checks it and saves it; in CI, set AMPOST_API_KEY instead.
terminal
ampost login
ampost accounts list
ampost post "Hello from the Ampost CLI 👋" -p bluesky,threads --waitWhat it does
- Publish now, schedule (
--schedule), add to the posting queue (--queue) or save a draft (--draft), with local files (-m ./photo.jpg) or https URLs. - List, publish, retry, discard, unpublish and edit published posts; check or disconnect accounts; import a CSV; read analytics; manage webhooks.
--jsonprints one JSON document on stdout, and the exit code says what happened: 3 for a refused key, 6 for an invalid post, 10 when--waitsees a network fail.--idempotency-keymakes a re-run of the same command safe: no duplicate post.
In scripts and CI
ampost help lists every command and ampost <command> --help its options. The GitHub Actions guide uses the CLI to announce every release.
release.sh
export AMPOST_API_KEY="$AMPOST_KEY_FROM_YOUR_SECRET_STORE"
ampost post --text-file notes.md -p bluesky,threads --wait --json \
--idempotency-key "notes-$(date +%F)"Links
- Source code (MIT): github.com/ampost-io/ampost-cli
- Package: npm: ampost-cli
- Guide: Post to social media from GitHub Actions with Ampost
- REST API reference