AthenousDevelopers

Athenous CLI

The athenous command manages campaigns, automation rules, and posts from a terminal. It needs Node.js 18 or newer and an API key with the cli scope.

The package is not on the public npm registry. Run it from the Athenous CLI directory in the project.

Run it

cd cli
npm install
node index.js me

Link it onto your PATH with npm link inside cli, then call athenous.

Setup

Create a key in Settings → API keys and enable CLI. Then set the key in the environment or in ~/.athenous/config.json.

export ATHENOUS_API_KEY=ath_xxxx
export ATHENOUS_API_URL=https://public-api.athenous.io

athenous config --api-key ath_xxxx
athenous config --api-url https://public-api.athenous.io
athenous me

Each command posts the key to POST /api/v1/auth/cli/token and calls the API with Authorization: Bearer. Saved config looks like this:

{
  "apiUrl": "https://public-api.athenous.io",
  "apiKey": "ath_xxxx"
}

Environment variables win when the file has no value. ATHENOUS_API_URL and ATHENOUS_URL both set the base URL. athenous config with no flags prints the URL and the first 12 characters of the key.

Examples

athenous me
athenous campaigns:create -n "Spring launch" -d "Prospecting"
athenous campaigns:update CAMPAIGN_UUID -s ACTIVE
athenous rules:create -n "Weekday check" -t SCHEDULE -c "0 9 * * 1-5" --enabled
athenous rules:trigger RULE_UUID
athenous rules:runs RULE_UUID -l 10
athenous posts:get POST_UUID

athenous campaigns and athenous posts print a JSON array. Those two HTTP endpoints return a page object (content, totalElements, totalPages), so the commands print []. Read the page with curl, or open one id with campaigns:get and posts:get. athenous rules prints the array the rules endpoint returns.

Commands

Account

CommandDescription
athenous config [--api-key <key>] [--api-url <url>]Save or print the API key and base URL.
athenous mePrint the current account. whoami is the same command. Calls GET /api/v1/account/me.

Campaigns

CommandDescription
athenous campaignsCalls GET /api/v1/campaigns and prints an array. The endpoint returns a page, so this command prints [].
athenous campaigns:get <id>Get one campaign.
athenous campaigns:create [-n name] [-d description]Create a campaign. The default name is CLI campaign.
athenous campaigns:update <id> [-n name] [-d description] [-s status]Update a campaign. -s is sent as ?status=. Use DRAFT, SCHEDULED, ACTIVE, PAUSED, COMPLETED, or ARCHIVED.
athenous campaigns:delete <id>Delete a campaign.

Automation rules

CommandDescription
athenous rules [-e] [--trigger TYPE] [--tag TAG]List rules. -e keeps enabled rules. Trigger is SCHEDULE, EVENT, or MANUAL.
athenous rules:get <id>Get one rule.
athenous rules:create [-n name] [-d desc] [-t TYPE] [-c cron] [--enabled]Create a rule. Default trigger is MANUAL.
athenous rules:update <id> [-n name] [-d desc] [--enabled true|false]Update a rule.
athenous rules:enable <id>Enable a rule.
athenous rules:disable <id>Disable a rule.
athenous rules:delete <id>Delete a rule.
athenous rules:runs <id> [-l limit]List recent runs. Default limit is 20.
athenous rules:trigger <id>Run a rule now.

Posts

CommandDescription
athenous postsCalls GET /api/v1/posts and prints an array. The endpoint returns a page, so this command prints [].
athenous posts:get <id>Get one post.

Rule body

rules:create sends this JSON. Omitted flags use the defaults in the table. rules:update keeps the stored value for every field you do not pass, and sends ?enabled=true or ?enabled=false when you pass --enabled.

FieldCLI flagDefault
name-nCLI rule
description-dnull
triggerType-tMANUAL. Also SCHEDULE and EVENT.
triggerConfig-cCron expression for SCHEDULE. Otherwise null.
conditionsnull
actionsnull
priority0
tagsnull. Filter a list with --tag.
timezonenull
retryMaxnull
retryBackoffSecondsnull
eventTypenull
targetResourceTypenull

rules:enable is PATCH /api/v1/automation/rules/{id}/enable. rules:disable is the matching /disable path. rules:trigger is POST …/trigger. rules:runs is GET …/runs?limit=.