Callable Node
Callable nodes are the workhorses of Xentom workflows. They perform operations with side effects, can be invoked by other nodes, and can invoke other nodes in return. Callable nodes represent the main processing steps in a workflow, handling tasks like API calls, data transformations, database operations, and business logic.
Key Characteristics
- Bidirectional: Can be invoked by other nodes and can invoke other nodes
- Side Effects: Designed for operations that change state or interact with external systems
- Explicit Flow Control: Must call
next()to continue workflow execution - Async Support: Full support for asynchronous operations
- Error Handling: Can handle and propagate errors appropriately
Basic Structure
import * as i from '@xentom/integration-framework';
export const apiCall = i.nodes.callable({
// Optional: group your node in the UI
group: 'API/HTTP',
// Optional: custom display name
displayName: 'Make API Call',
// Optional: description for users and AI assistance
description: 'Performs HTTP requests to external APIs',
// Configuration inputs from the user
inputs: {
url: i.pins.data({
control: i.controls.text({
label: 'API Endpoint',
placeholder: 'https://api.example.com/data',
}),
}),
method: i.pins.data({
control: i.controls.select({
options: [
{ value: 'GET', label: 'GET' },
{ value: 'POST', label: 'POST' },
{ value: 'PUT', label: 'PUT' },
{ value: 'DELETE', label: 'DELETE' },
],
defaultValue: 'GET',
}),
}),
},
// Data outputs to pass to other nodes
outputs: {
data: i.pins.data({
displayName: 'Response Data',
description: 'The parsed response body',
}),
status: i.pins.data({
displayName: 'HTTP Status',
description: 'The HTTP status code',
}),
},
// Run function: performs the actual work
async run({ inputs, next, state }) {
try {
// Perform the API call
const response = await fetch(inputs.url, {
method: inputs.method,
});
const data = await response.json();
// Pass outputs to next nodes
next({
data,
status: response.status,
});
} catch (error) {
// Let the framework handle the error
throw error;
}
},
});Configuration Options
Prop
Type
The Run Function
The run function is where the main logic of a callable node lives. It receives comprehensive execution context:
Parameters
The run function receives an options object with:
Prop
Type
The Next Function
The next() function is crucial - it passes data to connected nodes and continues workflow execution:
// Simple case: pass all outputs
next({
result: processedData,
timestamp: new Date().toISOString(),
});
// With execution pins: specify which path to take
next('success', {
data: result,
});Callable nodes provide the flexibility and power needed to implement complex business logic while maintaining the visual workflow paradigm.
Trigger Node
Trigger nodes are the entry points for workflows in Xentom. They listen for external events and initiate workflow execution when those events occur. Trigger nodes can invoke other nodes but cannot be invoked themselves, making them the starting point of any automation flow.
Pure Node
Pure nodes are computational units that perform side-effect-free operations in Xentom workflows. They transform input data into output data without interacting with external systems, modifying state, or triggering other nodes. Pure nodes are automatically evaluated when their outputs are needed by other nodes.