Skip to main content

An outbound campaign contacts people for you: it imports contacts, then calls and texts them, moving each contact from node to node. The ADK syncs each campaign’s draft (its settings and nodes) and the code of its node functions.

Drafts onlyYour files hold the campaign’s draft. What is live changes only when you publish with poly campaign publish. Archived campaigns are not pulled.

Location

Optional. The folder name is the campaign’s name, lowercased, with punctuation replaced by _. Agent Studio allows two campaigns the same name, but each needs its own folder. When two names are the same ignoring case and punctuation, the oldest campaign keeps its name and a pull renames the other {name} (1), numbered on, with a warning. That campaign shows as changed, so a pull followed by a push sends the new name to Agent Studio. To rename a campaign, change name and rename the folder to match. The campaign keeps its identity, contacts and history when its nodes keep their names and types, though the trigger may be renamed too. Otherwise the push deletes the old campaign and creates a new one, with a new id. A campaign that has been published can’t be deleted. Pause it, then archive it, with poly campaign pause and poly campaign archive. It stops being pulled once it’s archived. When a campaign is renamed in Agent Studio, a pull moves its folder, and your edits to its saved nodes and code move too, as for a renamed flow. Nodes and function files you added since the last pull stay in the old folder: move them across by hand. When two campaigns swap names in Agent Studio, or one is deleted and another renamed to its name, the folder then holds a different campaign. Edits you made there before the pull now apply to the campaign that has that name, and the next push sends them to it. Pull before editing after such changes.

What a campaign contains

Fields

Settings

Settings the ADK doesn’t know yet are kept as they were pulled, but the ADK can’t send them. A settings change replaces every setting, so change the settings of a campaign that has any in Agent Studio, or update the ADK.

Nodes

Each node has a name, unique in the campaign, and a type with that type’s fields. Nodes refer to each other by name. A node’s function code lives in functions/{node_name}.py, with the name lowercased and punctuation replaced by _. Names are compared ignoring case and punctuation, so when Agent Studio has nodes named Call and call, a pull numbers the second one, as in call 2. A node Agent Studio has with no name, or with a name another node has, is named on pull and shows as changed until your next push sends that name. next, default_next and default_route name the node a contact moves to next. Branches have no id in the file: a branch keeps its id in Agent Studio while its variable stays the same, and a new branch gets a new one. A call or text always moves to its default_route; put a conditional after it to branch on how it went. Flow fields hold a flow’s name. Every node except wait and end has a function, and an end node may have one. A function has a name (a valid Python name) and a description. Its code goes in the node’s .py file, whose def line takes exactly the parameters the node is called with: A webhook trigger runs no function. Node positions on the Agent Studio canvas are not in the file. A node keeps its position, and a new node is placed next to the node that routes to it.
Renaming a nodeA node’s name is its identity in your files. A campaign has one trigger, so renaming or replacing the trigger keeps its id and history. Renaming any other node, or changing its type, deletes the node and creates a new one with a new id, which starts its history again. Rename its .py file to match.

Example

functions/import_contacts.py:

Validation

poly validate and poly push check:
  • name is present and under 256 characters, and description under 1024.
  • The folder name matches the campaign’s name.
  • A campaign deleted in the push has never been published.
  • Settings have the right types and allowed values:
    • use_case is transactional or marketing, and limits are positive whole numbers.
    • country is a real ISO 3166-1 alpha-2 code, in capitals.
    • default_timezone is a valid IANA time zone.
    • end_date is not before start_date.
    • contact_window has at least one day, its times are HH:mm, and it ends after it starts.
    • A campaign with settings the ADK doesn’t know has no settings changed, and a new campaign has none.
  • nodes is a list, every node has a name, and names are unique in the campaign, ignoring case and punctuation.
  • There is at most one trigger node, and a campaign that has a trigger in Agent Studio keeps one: rename or replace its trigger rather than delete it.
  • The trigger changes type only when another node becomes the trigger in the same push, and a published campaign’s trigger keeps its source_type.
  • Each node has a known type, its required fields, allowed values, and no fields its type doesn’t have.
  • A conditional node uses each branch variable once.
  • voicemail_script and voicemail_when are set when voicemail_enabled is true.
  • On a node that is new, changed type or had its routes changed, every route names a node in the campaign. Agent Studio keeps a route to a deleted node until you change it.
  • Function names are valid Python names, and code is not in the YAML.
  • On a node that is new, changed type, or had its code, function name or parameters changed, the function’s def line is whole on one line and takes exactly the node’s parameters.
  • Every file in functions/ belongs to a node with a function, and a node’s file is named after it. After renaming a node, rename its file too.

Best practices

  • Run poly campaign validate and poly campaign preview after every push, before you publish.
  • Name nodes after what they do, like Reminder call, so routes read clearly.
  • Keep node names stable: renaming a node other than the trigger gives it a new identity and history.
  • Make a campaign on a branch, merge it, then publish it from main.

Flows

Call and SMS nodes enter a flow by its name.

poly campaign

Validate, preview, test, publish, pause, resume and archive a campaign.
Last modified on November 27, 2026