poly campaign requires a subcommand.
Examples:
poly push first. validate and preview use your current branch, or main if your branch no longer exists, as other commands do. test, publish, pause, resume and archive act on the live campaign on main, whatever branch you are on, and take its name as main has it, so a campaign made on a branch must be merged first.
Outbound campaigns must be turned on for the project; otherwise every subcommand exits 1 and says so.
With --json, every "success": false result carries a short error. Once the project is loaded, it also carries campaign.
Agent Studio lets two campaigns share a name, and a pull renames the newer one {name} (1) until a push sends that name. Until then, the shared name matches both: name the campaign by its new name or its folder.
--state values are read as JSON when they parse as JSON, so attempts=2, booked=true and note=null give a number, a boolean and null. Any other value, such as plan=gold, is kept as a string. --contact and --sample-outputs take a JSON file. --run and --last-send take the JSON the previous step printed.
poly campaign validate
Check a campaign’s graph with the platform: one trigger, routes to nodes that exist, every node reachable, and each node function’s def line. poly validate checks the files’ fields locally; this checks the graph.
Examples:
1 when the campaign is not valid, with an error beside the result in --json. Warnings do not fail it.
--json output shape:
result is the platform’s, with each issue’s node named in node and in its message; node_id keeps the id.
poly campaign preview
Walk a made-up contact through the campaign to the next call, condition or end. Nothing is called, texted or stored, and node functions are not run: say what each returns with --sample-outputs.
Examples:
1 when the path stops at a failed node (stop_reason is error) or hits the step cap (step_cap), which usually means the campaign loops. A preview keeps nothing between steps. Each step prints the flags to carry on with, including --last-send when the step left a call or a text: pass it back, so that the next step’s conditions and templates read it as journey.last_send.
--json output shape:
result is the platform’s, with each node named next to its id: node and next_node on each step, and stopped_at_node, resume_node and the error’s node.
poly campaign test
Run one step of a test of the live campaign, and wait for it to finish. It calls and texts the test contact for real. The first step starts at the trigger. To carry on, pass the --start-node and the run it printed. After a call or a text, also say how it went with --result; after a wait, carry on from the node it printed.
Without --json, the run is printed as soon as the step starts; the step carries on if you stop waiting. Node names are matched as they are on main, which the test runs, even from another branch. A step that fails, is interrupted, stops at a failed node or hits the step cap exits 1. An interrupted step may already have called or texted.
Examples:
--json output shape:
result names the nodes as preview’s does, as they are on main. The result is printed once the step stops, with an error when success is false. If waiting for the step fails or times out, the error carries the step and its run:
poly campaign publish
Publish the campaign’s draft to live and start it. A paused campaign stays paused.
Examples:
--json output shape:
poly campaign pause
Pause the live campaign.
Examples:
--json output shape:
poly campaign resume
Resume the paused campaign.
Examples:
--json output shape:
Set up campaigns once in Agent StudioPublishing or resuming needs the project’s campaigns to have been set up, which only Agent Studio can do. If the platform says the project is not set up yet, publish or resume a campaign once in Agent Studio, then try again.
poly campaign archive
Archive a draft or paused campaign. Archiving cannot be undone, and an archived campaign is no longer pulled.
Examples:
--json output shape:

