Skip to content
LogoLogo

Workflow schema

See Management API schema for every domain, the endpoint and authentication.

Queries

workflow

Reads a workflow. Scope: ORGANIZATION_WORKSPACE_READ.

workflow(id: ID!): Workflow @auth

workflowTools

Lists every tool a workflow node can run, with the arguments each takes.

workflowTools(
  """
  The project whose installed apps' tools to include, as `app.<slug>.<tool>`.
  """
  projectId: ID
): [WorkflowToolDefinition!]! @auth

workflows

Lists the workflows in a workspace. search matches a case-insensitive substring of the name. Scope: ORGANIZATION_WORKSPACE_READ.

workflows(first: Int, after: String, last: Int, before: String, workspaceId: ID!, search: String, sortKey: WorkflowSortKeys = NAME, reverse: Boolean = false): WorkflowConnection! @auth

Mutations

workflowCreate

Creates a workflow in a workspace. The caller must hold the scopes the workflow needs, as Workflow.scopes describes. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workflowCreate(input: WorkflowCreateInput!): WorkflowCreatePayload! @auth

workflowUpdate

Updates the name or the node visit limit of a workflow. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workflowUpdate(input: WorkflowUpdateInput!): WorkflowUpdatePayload! @auth

workflowGraphUpdate

Updates the graph of a workflow with a change set, all or nothing. A refused change set writes nothing and comes back in errors. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workflowGraphUpdate(input: WorkflowGraphUpdateInput!): WorkflowGraphUpdatePayload! @auth

workflowDelete

Deletes a workflow. Published versions keep their copy, and an action that started it can start another workflow. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workflowDelete(input: WorkflowDeleteInput!): WorkflowDeletePayload! @auth

workflowTestRun

Tests a workflow by walking its draft graph once, holding back every write. Nothing is stored, and the caller must also hold every scope in Workflow.scopesToHold. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workflowTestRun(input: WorkflowTestRunInput!): WorkflowTestRunPayload! @auth

Types

Workflow

"""
An automation in a workspace: when its trigger fires, a run walks its graph of `nodes` and
`edges`. Publishing freezes a copy into the version, so an edit does not change a published
version.
"""
type Workflow {
  """The ID of the workflow."""
  id: ID!
  """The name of the workflow."""
  name: String!
  """What starts a run. Set at creation and fixed after."""
  trigger: WorkflowTrigger!
  """
  The scopes a run acts with: those the tools the graph names declare, and
  `ORGANIZATION_LEADS_READ` for a `LEAD_CREATED` or `LEAD_UPDATED` trigger, which reads its lead.
  They are set when the workflow is created, imported or its graph is saved. Saving needs each of them except `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_ACTION_RUNS_READ`,
  `ORGANIZATION_ACTION_RUNS_UPDATE` and `ORGANIZATION_EXTERNAL_APIS_CALL`, which any author grants.
  """
  scopes: [Scope!]!
  """
  The scopes in `scopes` a person must hold to save the graph, test-run the workflow or rerun one
  of its runs: every one except those any author grants.
  """
  scopesToHold: [Scope!]!
  """The nodes of the graph."""
  nodes: [WorkflowNode!]!
  """The edges of the graph."""
  edges: [WorkflowEdge!]!
  """
  The most times a run can visit one node, from 1 to 100; 10 by default. A run that reaches a node
  this many times fails with `loop_limit_reached`.
  """
  maxNodeVisits: Int!
  """When the workflow was created."""
  createdAt: DateTime!
  """When the workflow last changed."""
  updatedAt: DateTime!
  """The workspace of the workflow."""
  workspace: Workspace!
  """The ID of the workspace of the workflow."""
  workspaceId: ID
  """
  Every path the templates and rules of the workflow can address: the trigger, the output of each
  tool by `nodes.<id>`, and the run variables.
  """
  references: WorkflowReferences!
}

WorkflowTriggerType

"""The kind of workflow trigger."""
enum WorkflowTriggerType {
  """A domain event starts the run."""
  EVENT
  """An action starts the run."""
  ACTION
}

WorkflowEventName

"""
The domain events that can start a workflow. An action starts a workflow through an `ACTION`
trigger.
"""
enum WorkflowEventName {
  """A workspace was created."""
  WORKSPACE_CREATED
  """A workspace was updated."""
  WORKSPACE_UPDATED
  """A workspace was deleted."""
  WORKSPACE_DELETED
  """A workspace version was published."""
  WORKSPACE_PUBLISHED
  """A feature flag was created."""
  FEATURE_CREATED
  """A feature flag was updated."""
  FEATURE_UPDATED
  """A feature flag was deleted."""
  FEATURE_DELETED
  """A step was deleted."""
  STEP_DELETED
  """A condition was deleted."""
  CONDITION_DELETED
  """An action was deleted."""
  ACTION_DELETED
  """A lead was created."""
  LEAD_CREATED
  """
  A person or an API key changed a lead. A change a workflow run makes starts no workflow.
  """
  LEAD_UPDATED
}

WorkflowTrigger

"""What starts the runs of a workflow. `__typename` names the kind."""
interface WorkflowTrigger {
  """The kind of trigger."""
  type: WorkflowTriggerType!
}

WorkflowEventTrigger

"""A trigger that starts a run on a domain event."""
type WorkflowEventTrigger implements WorkflowTrigger {
  """The kind of trigger."""
  type: WorkflowTriggerType!
  """The event that starts the run."""
  eventName: WorkflowEventName!
}

WorkflowActionTrigger

"""
A trigger that starts a run when an action runs. An action starts at most one workflow.
"""
type WorkflowActionTrigger implements WorkflowTrigger {
  """The kind of trigger."""
  type: WorkflowTriggerType!
  """The ID of the action."""
  actionId: ID!
  """The action. Null when the action was deleted."""
  action: Action
}

WorkflowTriggerInput

"""A workflow trigger to set. Only the field that matches `type` is read."""
input WorkflowTriggerInput {
  """The kind of trigger."""
  type: WorkflowTriggerType!
  """The event that starts the run, for an `EVENT` trigger."""
  eventName: WorkflowEventName
  """
  The ID of an action that starts no workflow yet, for an `ACTION` trigger.
  """
  actionId: ID
}

WorkflowNodeType

"""The kind of workflow node."""
enum WorkflowNodeType {
  """Where a run starts. Exactly one per workflow."""
  ORIGIN
  """Runs a tool."""
  TOOL
  """Chooses a branch by a rule."""
  CONDITION
  """Pauses the run for a duration."""
  SLEEP
}

WorkflowEdgeHandle

"""The exit an edge leaves a node by."""
enum WorkflowEdgeHandle {
  """The branch a condition takes when its rule is true."""
  TRUE
  """The branch a condition takes when its rule is false."""
  FALSE
  """The exit a run takes when a tool fails."""
  ERROR
}

WorkflowNode

"""A node in the graph of a workflow. `__typename` names the kind."""
interface WorkflowNode {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: Position!
}

WorkflowOriginNode

"""The node where every run starts. Exactly one per workflow."""
type WorkflowOriginNode implements WorkflowNode {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: Position!
}

WorkflowToolNode

"""A node that runs a tool."""
type WorkflowToolNode implements WorkflowNode {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: Position!
  """The name of the tool."""
  tool: String!
  """The values of the arguments of the tool."""
  configuration: JSON!
  """
  The title the author gave the node. Null when the canvas shows the name of the tool.
  """
  title: String
}

WorkflowConditionNode

"""
A node that chooses a branch. Its outgoing edges carry `sourceHandle` `TRUE` or `FALSE`.
"""
type WorkflowConditionNode implements WorkflowNode {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: Position!
  """The rule the node evaluates."""
  logic: JSON!
  """
  The title the author gave the node. Null when the canvas shows a summary of the rule.
  """
  title: String
}

WorkflowSleepNode

"""A node that pauses the run."""
type WorkflowSleepNode implements WorkflowNode {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: Position!
  """
  The length of the pause, as a count and a unit such as `500ms`, `30s`, `5m`, `2h` or `1d`. At most one day.
  """
  duration: String!
}

WorkflowEdge

"""A connection between two nodes in the graph of a workflow."""
type WorkflowEdge {
  """The ID of the edge, unique in the graph."""
  id: ID!
  """The ID of the node the edge leaves."""
  sourceNodeId: ID!
  """The ID of the node the edge arrives at."""
  destinationNodeId: ID!
  """
  The exit the edge leaves by: `TRUE` or `FALSE` from a condition, `ERROR` from a tool. Null for any other exit.
  """
  sourceHandle: WorkflowEdgeHandle
}

WorkflowToolNodeInput

"""The data of a `TOOL` node: the tool and its arguments."""
input WorkflowToolNodeInput {
  """The name of a tool that `workflowTools` lists."""
  name: String!
  """
  The values of the arguments of the tool. Omit for a tool with no arguments.
  """
  configuration: JSON
  """A title for the node, at most 80 characters. Omit for none."""
  title: String
}

WorkflowConditionNodeInput

"""The data of a `CONDITION` node: the rule that chooses the branch."""
input WorkflowConditionNodeInput {
  """The rule the node evaluates."""
  logic: JSON!
  """A title for the node, at most 80 characters. Omit for none."""
  title: String
}

WorkflowSleepNodeInput

"""The data of a `SLEEP` node: the length of the pause."""
input WorkflowSleepNodeInput {
  """
  A count and a unit, such as `500ms`, `30s`, `5m`, `2h` or `1d`. At most one day.
  """
  duration: String!
}

WorkflowNodeInput

"""
A node to set in a graph. The block that matches `type` carries its data; `ORIGIN` has none.
"""
input WorkflowNodeInput {
  """The ID of the node, unique in the graph."""
  id: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: PositionInput!
  """The tool and its arguments, for a `TOOL` node."""
  tool: WorkflowToolNodeInput
  """The rule, for a `CONDITION` node."""
  condition: WorkflowConditionNodeInput
  """The length of the pause, for a `SLEEP` node."""
  sleep: WorkflowSleepNodeInput
}

WorkflowEdgeInput

"""An edge to set in a graph."""
input WorkflowEdgeInput {
  """The ID of the edge, unique in the graph."""
  id: ID!
  """The ID of the node the edge leaves."""
  sourceNodeId: ID!
  """The ID of the node the edge arrives at."""
  destinationNodeId: ID!
  """
  The exit the edge leaves by: `TRUE` or `FALSE` from a condition, `ERROR` from a tool.
  """
  sourceHandle: WorkflowEdgeHandle
}

WorkflowArgumentType

"""
The type of a tool argument. Every argument also takes a workflow template such as
`{{ nodes.n1.leads[0].id }}`: a template that is the whole value keeps the type of what it names,
and one mixed with text is read as the declared type when the node runs.
"""
enum WorkflowArgumentType {
  """Text."""
  STRING
  """A number."""
  NUMBER
  """True or false."""
  BOOLEAN
  """Any JSON value."""
  JSON
  """
  A query in the query language of one resource. A template can stand only in the value of a
  clause.
  """
  QUERY
  """
  A reference to one record of the type `resourceType` names, which resolves to the ID of the
  record before the tool runs.
  """
  REFERENCE
}

WorkflowToolArgument

"""An argument a tool takes."""
type WorkflowToolArgument {
  """
  The name of the argument, as a key in the `configuration` of a tool node.
  """
  name: String!
  """The display name of the argument, such as `Lead`."""
  label: String!
  """The type of the argument."""
  type: WorkflowArgumentType!
  """
  The structured shape of a `JSON` argument, such as `labels`. Null for free-form JSON. The set of
  shapes can grow; edit an unknown shape as raw JSON.
  """
  shape: String
  """
  The resource type a `REFERENCE` argument names, such as `Lead`, matched by equality against
  `WorkflowReferenceEntry.resourceType`. Null for other types.
  """
  resourceType: String
  """
  The values a `STRING` argument accepts. Null when it accepts any string.
  """
  options: [String!]
  """Whether the argument is required."""
  required: Boolean!
  """What the argument is for."""
  description: String!
}

WorkflowToolDefinition

"""A tool a workflow node can run."""
type WorkflowToolDefinition {
  """The name a tool node uses."""
  name: String!
  """The display name of the tool, such as `External endpoint`."""
  label: String!
  """What the tool does."""
  description: String!
  """The arguments the tool takes."""
  arguments: [WorkflowToolArgument!]!
  """
  The scopes a run needs to run the tool. Empty for a tool that touches no data.
  """
  scopes: [Scope!]!
}

WorkflowReferenceType

"""The type of the value at a reference path."""
enum WorkflowReferenceType {
  """Text."""
  STRING
  """A number."""
  NUMBER
  """True or false."""
  BOOLEAN
  """Any JSON value. Paths beneath it are not listed."""
  JSON
  """A record, with its fields listed beneath it."""
  OBJECT
  """
  A list addressed by index. `.0.` entries describe each item, and `.truncated` says whether the list was cut short.
  """
  COLLECTION
}

WorkflowReferenceEntry

"""
A path that the templates and rules of a workflow can address. The path is relative to its owner,
in dotted form: `action.responses.email` beneath `trigger`, `leads.0.id` beneath `nodes.<id>`. A
template writes an index as `leads[0].id`.
"""
type WorkflowReferenceEntry {
  """The path, relative to its owner."""
  path: String!
  """The type of the value."""
  type: WorkflowReferenceType!
  """The display name of the path."""
  label: String!
  """What the path holds."""
  description: String!
  """An example value."""
  example: JSON!
  """
  The resource type of a path that names a whole record or its ID, such as `Lead`, matched by
  equality against `WorkflowToolArgument.resourceType`. Null for other paths.
  """
  resourceType: String
}

WorkflowToolReferences

"""
The paths the output of one tool adds beneath `nodes.<id>` for each node that runs it.
"""
type WorkflowToolReferences {
  """The name of the tool."""
  tool: String!
  """The paths, relative to the node."""
  entries: [WorkflowReferenceEntry!]!
}

WorkflowReferences

"""
Every path the templates and rules of one workflow can address: the trigger, the output of each
tool with its shapes resolved against the fields of the workspace, and the run variables.
"""
type WorkflowReferences {
  """
  The paths beneath `trigger`: `action` and its responses for an `ACTION` trigger, `event` for an
  `EVENT` trigger, and `lead` with its responses and labels beside `event` for a `LEAD_CREATED` or
  `LEAD_UPDATED` trigger.
  """
  trigger: [WorkflowReferenceEntry!]!
  """The paths beneath `nodes.<id>`, by the tool the node runs."""
  tools: [WorkflowToolReferences!]!
  """
  The run variables, the same on every workflow, each written from its root: `run.id`,
  `run.startedAt`, `run.preview`, `workflow.id`, `workflow.name`, `current.id`,
  `current.startedAt` and `current.visit`. Times are in UTC. A save refuses any other path beneath
  these three roots.
  """
  variables: [WorkflowReferenceEntry!]!
}

WorkflowChangesInput

"""The changes to a workflow graph."""
input WorkflowChangesInput {
  """The changes to nodes."""
  nodes: WorkflowNodeChangesInput
  """The changes to edges."""
  edges: WorkflowEdgeChangesInput
}

WorkflowNodeChangesInput

"""The changes to the nodes of a workflow graph."""
input WorkflowNodeChangesInput {
  """The nodes to create, each named by its `clientId`."""
  create: [WorkflowNodeCreateData!]
  """
  The changes to existing nodes. An ID the graph does not have is ignored.
  """
  update: [WorkflowNodeUpdateData!]
  """
  The IDs of the nodes to delete. The edges of a deleted node are deleted with it.
  """
  delete: [ID!]
}

WorkflowNodeCreateData

"""A node to create. The block that matches `type` carries its data."""
input WorkflowNodeCreateData {
  """
  An ID of your choice, which edges in the same change set can name. The result maps it to the
  node ID in `idMappings`.
  """
  clientId: ID!
  """The kind of node."""
  type: WorkflowNodeType!
  """The position of the node on the canvas."""
  position: PositionInput!
  """The tool and its arguments, for a `TOOL` node."""
  tool: WorkflowToolNodeInput
  """The rule, for a `CONDITION` node."""
  condition: WorkflowConditionNodeInput
  """The length of the pause, for a `SLEEP` node."""
  sleep: WorkflowSleepNodeInput
}

WorkflowNodeUpdateData

"""
A change to an existing node. Omit a field to keep its value; a kind block replaces all the data
of that kind.
"""
input WorkflowNodeUpdateData {
  """The ID of the node."""
  id: ID!
  """The position of the node on the canvas."""
  position: PositionInput
  """The tool and its arguments, for a `TOOL` node."""
  tool: WorkflowToolNodeInput
  """The rule, for a `CONDITION` node."""
  condition: WorkflowConditionNodeInput
  """The length of the pause, for a `SLEEP` node."""
  sleep: WorkflowSleepNodeInput
}

WorkflowEdgeChangesInput

"""The changes to the edges of a workflow graph."""
input WorkflowEdgeChangesInput {
  """The edges to create, each named by its `clientId`."""
  create: [WorkflowEdgeCreateInput!]
  """
  The changes to existing edges. An ID the graph does not have is ignored.
  """
  update: [WorkflowEdgeUpdateInput!]
  """The IDs of the edges to delete."""
  delete: [ID!]
}

WorkflowEdgeCreateInput

"""
An edge to create. Name each end once: by node ID, or by the `clientId` of a node created in the
same change set.
"""
input WorkflowEdgeCreateInput {
  """
  An ID of your choice. The result maps it to the edge ID in `idMappings`.
  """
  clientId: ID!
  """
  The ID of the node the edge leaves. Not allowed with `sourceNodeClientId`.
  """
  sourceNodeId: ID
  """
  The `clientId` of a new node the edge leaves. Not allowed with `sourceNodeId`.
  """
  sourceNodeClientId: ID
  """
  The ID of the node the edge arrives at. Not allowed with `destinationNodeClientId`.
  """
  destinationNodeId: ID
  """
  The `clientId` of a new node the edge arrives at. Not allowed with `destinationNodeId`.
  """
  destinationNodeClientId: ID
  """
  The exit the edge leaves by: `TRUE` or `FALSE` from a condition, `ERROR` from a tool.
  """
  sourceHandle: WorkflowEdgeHandle
}

WorkflowEdgeUpdateInput

"""A change to an existing edge. Omit a field to keep its value."""
input WorkflowEdgeUpdateInput {
  """The ID of the edge."""
  id: ID!
  """The ID of the node the edge leaves."""
  sourceNodeId: ID
  """The ID of the node the edge arrives at."""
  destinationNodeId: ID
  """
  The exit the edge leaves by: `TRUE` or `FALSE` from a condition, `ERROR` from a tool.
  """
  sourceHandle: WorkflowEdgeHandle
}

WorkflowConnection

"""A page of workflows."""
type WorkflowConnection {
  """The edges in this page."""
  edges: [WorkflowConnectionEdge!]!
  """The workflows in this page."""
  nodes: [Workflow!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The total number of workflows."""
  totalCount: Int!
}

WorkflowConnectionEdge

"""A workflow in a page of results."""
type WorkflowConnectionEdge {
  """The cursor of this edge."""
  cursor: String!
  """The workflow."""
  node: Workflow!
}

WorkflowCreateInput

"""The input of `workflowCreate`."""
input WorkflowCreateInput {
  """The ID of the workspace."""
  workspaceId: ID!
  """
  The name. When omitted, a name taken from the trigger, with a number added until it is unique.
  """
  name: String
  """What starts a run. Fixed after creation."""
  trigger: WorkflowTriggerInput!
  """The nodes of the graph. The `ORIGIN` node is added when absent."""
  nodes: [WorkflowNodeInput!]
  """The edges of the graph. Ignored without `nodes`."""
  edges: [WorkflowEdgeInput!]
}

WorkflowCreatePayload

"""The result of `workflowCreate`."""
type WorkflowCreatePayload {
  """The workflow."""
  workflow: Workflow
}

WorkflowUpdateInput

"""The input of `workflowUpdate`. Omit a field to keep its value."""
input WorkflowUpdateInput {
  """The ID of the workflow."""
  id: ID!
  """The name."""
  name: String
  """The most times a run can visit one node, from 1 to 100."""
  maxNodeVisits: Int
}

WorkflowGraphUpdateInput

"""
The input of `workflowGraphUpdate`. Omit a field to keep its value. `changes` is required.
"""
input WorkflowGraphUpdateInput {
  """The ID of the workflow."""
  workflowId: ID!
  """The name."""
  name: String
  """The most times a run can visit one node, from 1 to 100."""
  maxNodeVisits: Int
  """The changes to the graph."""
  changes: WorkflowChangesInput!
}

WorkflowGraphUpdatePayload

"""The result of `workflowGraphUpdate`."""
type WorkflowGraphUpdatePayload {
  """
  The workflow with every change applied. Null when `errors` is not empty.
  """
  workflow: Workflow
  """
  The reasons the change set was refused, one per problem. Empty on success.
  """
  errors: [UserError!]!
  """
  The nodes of a saved graph that will not run as meant: a node no path from the origin reaches, a
  sleep of no length, or an `http` call to an origin the project has not registered as an
  external API. Empty when `errors` is not empty.
  """
  warnings: [UserError!]!
  """
  The ID given to each created node and edge. Empty when `errors` is not empty.
  """
  idMappings: WorkflowIdMappings!
}

WorkflowIdMappings

"""
The IDs given to the nodes and edges a change set created, by `clientId`.
"""
type WorkflowIdMappings {
  """The node IDs, in the order the nodes were created."""
  nodes: [IdMapping!]!
  """The edge IDs, in the order the edges were created."""
  edges: [IdMapping!]!
}

WorkflowUpdatePayload

"""The result of `workflowUpdate`."""
type WorkflowUpdatePayload {
  """The workflow."""
  workflow: Workflow
}

WorkflowDeleteInput

"""The input of `workflowDelete`."""
input WorkflowDeleteInput {
  """The ID of the workflow."""
  id: ID!
}

WorkflowDeletePayload

"""The result of `workflowDelete`."""
type WorkflowDeletePayload {
  """The ID of the deleted workflow."""
  deletedWorkflowId: ID
}

WorkflowTestRunInput

"""
The input of `workflowTestRun`. Give the field the trigger of the workflow takes, and omit the
other.
"""
input WorkflowTestRunInput {
  """The ID of the workflow."""
  workflowId: ID!
  """
  The answers the action carries, keyed by field key, for an `ACTION` trigger. Templates and rules
  read them as `trigger.action.responses.<key>`. Defaults to none. Refused for an `EVENT` trigger.
  """
  responses: JSON
  """
  The ID of the entity the event is about, for an `EVENT` trigger, read as `trigger.entityId`.
  For `lead.created` and `lead.updated` it is the lead, read as `trigger.lead`. Defaults to the ID
  of the workspace.
  """
  entityId: ID
  """
  Whether tools that write run for real, as the workflow, as in a live run. Labels set on the run
  are held under its `test_` ID and removed when it ends, and the test run stops after 60 seconds.
  Defaults to false.
  """
  executeWrites: Boolean = false
}

WorkflowTestRunStatus

"""How a test run ended."""
enum WorkflowTestRunStatus {
  """Every node reached did its work or was skipped."""
  COMPLETED
  """
  A node failed, or a test run that executes writes passed its 60-second limit.
  """
  FAILED
}

WorkflowTestRunTaskStatus

"""How one task of a test run ended."""
enum WorkflowTestRunTaskStatus {
  """The node did its work. A tool that only reads ran for real."""
  SUCCEEDED
  """
  The node failed, which stopped the test run. A tool still running at the 60-second limit is
  `FAILED`, and its writes can still land.
  """
  FAILED
  """
  The tool writes and the test run does not execute writes, or the tool never runs in a test run.
  `input` holds what it would have sent, and a later node that reads its output finds nothing.
  """
  SKIPPED
}

WorkflowTestRunTask

"""One visit of a test run to a node. It is not stored."""
type WorkflowTestRunTask {
  """The ID of the node."""
  nodeId: ID!
  """
  The position of the task in the test run, from 1. The `ORIGIN` node is 0 and is not listed.
  """
  index: Int!
  """The number of the visit to the node, from 1."""
  visit: Int!
  """The kind of node. Never `ORIGIN`."""
  type: WorkflowTaskType!
  """The tool of a `TOOL` node. Null for other kinds."""
  tool: String
  """How the task ended."""
  status: WorkflowTestRunTaskStatus!
  """
  The arguments of a `TOOL` node with every template resolved, as the tool received them or would
  have. For a `SLEEP` node, `{ duration }`.
  """
  input: JSON
  """
  The output of a `TOOL` node, as later nodes read it; a reference is a `$ref` envelope that names
  the tool and what it resolves. An `action_response` node also carries its `payload`. Null when
  skipped.
  """
  output: JSON
  """The branch a `CONDITION` node took. Null for other kinds."""
  branch: WorkflowEdgeHandle
  """
  Why the task failed, naming the node, its tool and at most one argument. Null unless it failed.
  """
  failureMessage: String
}

WorkflowTestRun

"""
One walk of the draft graph of a workflow against a given trigger. Tools that only read run for
real, tools that write are `SKIPPED` unless the input sets `executeWrites`, and `SLEEP` nodes do
not wait. With `executeWrites`, what the writes store and record remains.
"""
type WorkflowTestRun {
  """How the test run ended."""
  status: WorkflowTestRunStatus!
  """
  Why the test run stopped: a run failure code such as `node_failed`, or `test_run_timed_out` when
  a test run that executes writes passed its 60-second limit. Null unless `status` is `FAILED`.
  """
  failureCode: String
  """Why the test run stopped. Null unless `status` is `FAILED`."""
  failureMessage: String
  """Every node the test run reached after the `ORIGIN`, in order."""
  tasks: [WorkflowTestRunTask!]!
}

WorkflowTestRunPayload

"""The result of `workflowTestRun`."""
type WorkflowTestRunPayload {
  """The test run. Null when `userErrors` is not empty."""
  testRun: WorkflowTestRun
  """
  The reasons the input cannot start the workflow, with codes `RESPONSES_NOT_ACCEPTED`,
  `INVALID_RESPONSES`, `ACTION_DELETED` or `TRIGGER_UNUSABLE`.
  """
  userErrors: [UserError!]!
}

WorkflowSortKeys

"""The orders `workflows` can sort by. `reverse: true` flips the order."""
enum WorkflowSortKeys {
  """By `name`, A to Z."""
  NAME
  """By `createdAt`, oldest first."""
  CREATED_AT
  """By `updatedAt`, oldest first."""
  UPDATED_AT
}