Skip to content
TriedDocs
Conversation flows

Create flow component

Add a reusable subflow to the workspace component library.

POSThttps://api.tried.com.au/create-conversation-flow-component

Creates a shared component (subflow) that any conversation flow can run through a component node. The component's start node is its Begin node, and its component_exit nodes return control to the calling flow.

Request#

Body#

Field Type Required Description
name string No Display name. Default "".
nodes object[] No Nodes, same schema as a flow. Default [].
start_node_id string or null No First node. Default null.
tools object[] No Tools with a tool_id, for the component's function nodes.
begin_tag_display_position object No { "x", "y" } of the Begin tag.

Example request#

curl -X POST "https://api.tried.com.au/create-conversation-flow-component" \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Collect callback number",
  "start_node_id": "node_ask",
  "nodes": [
    {
      "id": "node_ask",
      "type": "conversation",
      "instruction": {
        "type": "prompt",
        "text": "Ask for the best callback number and read it back."
      },
      "edges": [
        {
          "id": "edge_ok",
          "destination_node_id": "node_exit",
          "transition_condition": {
            "type": "prompt",
            "prompt": "Caller confirmed the number"
          }
        }
      ]
    },
    {
      "id": "node_exit",
      "type": "component_exit"
    }
  ]
}'
const res = await fetch("https://api.tried.com.au/create-conversation-flow-component", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Collect callback number",
    "start_node_id": "node_ask",
    "nodes": [
      {
        "id": "node_ask",
        "type": "conversation",
        "instruction": {
          "type": "prompt",
          "text": "Ask for the best callback number and read it back."
        },
        "edges": [
          {
            "id": "edge_ok",
            "destination_node_id": "node_exit",
            "transition_condition": {
              "type": "prompt",
              "prompt": "Caller confirmed the number"
            }
          }
        ]
      },
      {
        "id": "node_exit",
        "type": "component_exit"
      }
    ]
  }),
});
const data = await res.json();
import os, requests

res = requests.post(
    "https://api.tried.com.au/create-conversation-flow-component",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={
        "name": "Collect callback number",
        "start_node_id": "node_ask",
        "nodes": [
            {
                "id": "node_ask",
                "type": "conversation",
                "instruction": {
                    "type": "prompt",
                    "text": "Ask for the best callback number and read it back.",
                },
                "edges": [
                    {
                        "id": "edge_ok",
                        "destination_node_id": "node_exit",
                        "transition_condition": {
                            "type": "prompt",
                            "prompt": "Caller confirmed the number",
                        },
                    },
                ],
            },
            {
                "id": "node_exit",
                "type": "component_exit",
            },
        ],
    },
)
data = res.json()

Response#

201 Created

{
  "component_id": "component_8a9b0c1d2e3f4a5b6c7d8e9f",
  "name": "Collect callback number",
  "start_node_id": "node_ask",
  "nodes": [],
  "version": 0,
  "last_modification_timestamp": 1792310400000
}

nodes is shortened above. A new component is version 0; every update adds one.

Errors#

Status When
400 Validation failed.
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the agents scope.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.