https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do I add a function node via the api to my con...
# ❓・ai-evy-support
p
@AI Evy how do I add a function node via the api to my conversation flow agent
a
Thanks for tagging me @punk8357. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) [[2] Node Overview](https://docs.retellai.com/build/conversation-flow/node) [[3] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) [[4] Tool creation not working via conversation_flow method (python sdk)](https://discord.com/channels/1186424376300679209/1408324136060715099) ​
### Answer To add a function node to your conversation flow agent via the API, you can use the Update Conversation Flow endpoint. [(1) ]() The
nodes
array accepts different node types, including function nodes. [(2) ]() [(1) ]() Here's the general approach using the JavaScript SDK:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
[(3) ]() You would then call the update endpoint with your nodes array that includes a function node. The
nodes
parameter accepts multiple node type options. [(1) ]() Important note: Based on community feedback, when creating tools/functions, you may need to use the Update Conversation Flow API rather than the Create endpoint, as the
tools
parameter on create may not work as expected. [(4) ]() Available node types include: [(2) ]() - **Function Node**: Execute custom functions and API calls - **Conversation Node**: Handle dialogue and user interactions - **Extract DV Node**: Extract and store dynamic variables - SMS Node, MCP Node, Call Transfer Node, End Node, Logic Split Node, etc. For the specific function node schema and required fields, I recommend checking the full API reference at [Update Conversation Flow]() . [(1) ]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy when I create an agent how do I create convo nodes and subnodes/children/branches off of different nodes
a
Thanks for the follow-up, @punk8357. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) [[2] Retell AI’s Advanced Conversation Flow | Retell AI](https://www.retellai.com/blog/unlocking-complex-interactions-with-retell-ais-conversation-flow) [[3] Node Overview](https://docs.retellai.com/build/conversation-flow/node) [[4] Logic Split Node](https://docs.retellai.com/build/conversation-flow/logic-split-node) ​
### Answer When creating a conversation flow via the API, you define nodes and connect them using edges. [(1) ]() Creating Nodes: Each node in the
nodes
array has an
id
,
type
, and
instruction
. Creating Branches/Children (Edges) : Edges connect nodes and define transition conditions between them. [(2) ]() You add an
edges
array within a node to specify where it can transition to. [(1) ]() Here's an example showing how to create nodes with branches:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.create({
  model_choice: { model: 'gpt-4.1', type: 'cascading' },
  nodes: [
    {
      id: 'start',
      instruction: { text: 'Greet the customer and ask how you can help them.', type: 'prompt' },
      type: 'conversation',
    },
  ],
  start_speaker: 'agent',
}) ;
To add edges (branches) to a node, include the
edges
property with transition conditions:
Copy code
javascript
{
  "id": "start",
  "type": "conversation",
  "instruction": {
    "type": "prompt",
    "text": "Greet the customer and ask how you can help them."
  },
  "edges": [
    {
      "id": "edge_1",
      "transition_condition": {
        "type": "prompt",
        "prompt": "Customer wants to book appointment"
      },
      "destination_node_id": "book_appointment"
    }
  ]
}
Key concepts: - Nodes are the building blocks representing specific steps in the conversation [(3) ]() - Edges connect nodes and define transition conditions between them [(2) ]() - The
destination_node_id
in an edge points to the child/branch node [(1) ]() - For conditional branching, you can use a Logic Split Node which evaluates conditions and branches to corresponding destination nodes [(4) ]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy is there a way with the api to position the nodes in the retell dashboard so its easy to see them and they dont just all overlap?
a
Thanks for the follow-up, @punk8357. I'll get back to you soon.
### Answer Yes, you can set display positions for nodes via the API using the
begin_tag_display_position
property. [(1) ]() This property accepts
x
and
y
coordinates to control where elements appear in the dashboard:
Copy code
json
"begin_tag_display_position": {
  "x": 100,
  "y": 200
}
The
begin_tag_display_position
is available when creating or updating conversation flows and components. , [(2) ]() , [(3) ]() Additionally, if your nodes become cluttered after adding many of them, the Retell dashboard has an Organize button that automatically arranges nodes for better visibility. [(4) ]()
​ To learn more, see the sources I considered: [[1] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) [[2] Create Conversation Flow Component](https://docs.retellai.com/api-references/create-conversation-flow-component) [[3] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) [[4] Node Overview](https://docs.retellai.com/build/conversation-flow/node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy what is the min and max for x and y
a
Thanks for the follow-up, @punk8357. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) ​
### Answer The available documentation does not specify minimum or maximum values for the
x
and
y
coordinates in
begin_tag_display_position
. [(1) ]() The API reference only shows an example with values like
"x": 100
and
"y": 200
, but does not document any constraints or valid ranges for these coordinates. You may need to experiment with values or reach out to Retell support for specific limits. Would you like me to try to answer generally based on typical coordinate system behavior, or would you prefer to check with Retell directly? Check out these potentially useful sources: - [Create Conversation Flow]() - [Create Conversation Flow Component]() - [Contact Sales]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @punk8357. I'll get back to you soon.
p
where is the organiz ebutton @AI Evy
a
### Answer The Organize button is available in the Retell Dashboard when editing a conversation flow agent. [(1) ]() After adding a large number of nodes to your canvas, you can use the
Organize
button to automatically arrange and organize the nodes for better visibility. The documentation mentions this feature under the "Organize Nodes" section but does not specify the exact location of the button in the UI. Based on the context, it should be accessible somewhere on the conversation flow canvas/editor interface within the Dashboard.
​ To learn more, see the sources I considered: [[1] Node Overview](https://docs.retellai.com/build/conversation-flow/node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy In Retell tool calls/webhooks, do you receive the Retell agent_id (or call object that includes agent_id) on every tool invocation?
a
Thanks for the follow-up, @punk8357. I'll get back to you soon.
### Answer Yes, you can receive the
agent_id
in different ways depending on the type of webhook or tool call: Call Event Webhooks (
call_started
,
call_ended
,
call_analyzed
) :
The webhook payload includes the full call object which contains the
agent_id
. [(1) ]() Sample payload structure:
Copy code
json
{
  "event": "call_ended",
  "call": {
    "call_type": "phone_call",
    "from_number": "+12137771234",
    "to_number": "+12137771235",
    "direction": "inbound",
    "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
    "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
    ...
  }
}
LLM WebSocket (Custom LLM Tool Calls) : You can receive call details including
agent_id
by enabling it in the config event. The
call_details
event will be sent if configured. [(2) ]() The call details event includes: -
call_id
-
agent_id
-
from_number
,
to_number
-
metadata
-
retell_llm_dynamic_variables
Inbound Webhook: The inbound webhook payload includes
agent_id
if the number has an inbound agent id set. [(3) ]() So for tool calls specifically via the LLM WebSocket, you need to enable
call_details
in your config event to receive the
agent_id
at the start of the connection—it's not sent with every individual tool invocation request, but once at connection start. [(2) ]()
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] LLM WebSocket](https://docs.retellai.com/api-references/llm-websocket) [[3] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.