Actions

Perform operations with action nodes

Action nodes perform operations in your workflow - calling APIs, sending notifications, processing data, and more.

HTTP Request

Make HTTP calls to external APIs.

Configuration

json
{
  "type": "http_request",
  "method": "POST",
  "url": "https://api.example.com/users",
  "headers": {
    "Authorization": "Bearer {{ credentials.api_token }}",
    "Content-Type": "application/json"
  },
  "body": {
    "name": "{{ input.name }}",
    "email": "{{ input.email }}"
  },
  "timeout_ms": 30000
}

Options

OptionDescription
MethodGET, POST, PUT, PATCH, DELETE
URLEndpoint URL (supports variables)
HeadersRequest headers
BodyRequest body (JSON, form data, raw)
TimeoutRequest timeout in milliseconds
RetryRetry configuration

Output

javascript
{
  "status": 200,
  "headers": { ... },
  "body": { ... },
  "duration_ms": 150
}

Send Email

Send emails through configured providers.

Configuration

json
{
  "type": "send_email",
  "channel": "sendgrid-main",
  "to": "{{ input.customer_email }}",
  "subject": "Your order has shipped!",
  "body": "Hi {{ input.customer_name }},\n\nYour order #{{ input.order_id }} has shipped.",
  "from_name": "Support Team"
}

Options

OptionDescription
ChannelNotification channel to use
ToRecipient email(s)
CC/BCCCarbon copy recipients
SubjectEmail subject line
BodyPlain text or HTML content
AttachmentsFile attachments

HTML Email

json
{
  "type": "send_email",
  "content_type": "html",
  "body": "<h1>Welcome!</h1><p>Thanks for signing up, {{ input.name }}!</p>"
}

Send Notification

Send messages to Slack, Discord, SMS, and more.

Slack Example

json
{
  "type": "send_notification",
  "channel": "slack-alerts",
  "message": "New order received: #{{ input.order_id }}",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*New Order*\nCustomer: {{ input.customer_name }}\nAmount: ${{ input.amount }}"
      }
    }
  ]
}

SMS Example

json
{
  "type": "send_notification",
  "channel": "twilio-sms",
  "to": "{{ input.phone }}",
  "message": "Your verification code is: {{ input.code }}"
}

AI Agent

Invoke an AI agent to process data.

Configuration

json
{
  "type": "ai_agent",
  "agent_id": "agent_support",
  "message": "Please analyze this customer feedback: {{ input.feedback }}",
  "context": {
    "customer_id": "{{ input.customer_id }}",
    "product": "{{ input.product }}"
  }
}

Output

javascript
{
  "response": "Based on the feedback...",
  "tokens_used": 450,
  "model": "gpt-4",
  "tools_called": ["sentiment_analysis"]
}

Use Cases

  • Sentiment analysis
  • Content generation
  • Data extraction
  • Decision making
  • Translation

Database Query

Execute database queries.

SELECT Example

json
{
  "type": "database",
  "connection": "postgres-main",
  "operation": "select",
  "query": "SELECT * FROM orders WHERE customer_id = $1 AND status = $2",
  "parameters": ["{{ input.customer_id }}", "pending"]
}

INSERT Example

json
{
  "type": "database",
  "connection": "postgres-main",
  "operation": "insert",
  "table": "audit_logs",
  "data": {
    "action": "{{ input.action }}",
    "user_id": "{{ input.user_id }}",
    "timestamp": "{{ now() }}"
  }
}

Output

javascript
{
  "rows": [...],
  "row_count": 5,
  "affected_rows": 1
}

Execute Code

Run custom JavaScript or Python code.

JavaScript Example

json
{
  "type": "execute_code",
  "language": "javascript",
  "code": "const total = input.items.reduce((sum, item) => sum + item.price, 0);\nreturn { total, item_count: input.items.length };"
}

Python Example

json
{
  "type": "execute_code",
  "language": "python",
  "code": "import json\ntotal = sum(item['price'] for item in input['items'])\nreturn {'total': total}"
}

Available Context

  • input - Data from previous nodes
  • env - Environment variables
  • context - Execution context

Sub-Workflow

Call another workflow.

Configuration

json
{
  "type": "sub_workflow",
  "workflow_id": "wf_process_payment",
  "input": {
    "amount": "{{ input.total }}",
    "customer_id": "{{ input.customer_id }}"
  },
  "wait_for_completion": true
}

Options

OptionDescription
workflow_idTarget workflow ID
inputData to pass
wait_for_completionWait for result or fire-and-forget
timeout_msMax wait time

Transform Data

Modify data structure.

Configuration

json
{
  "type": "transform",
  "operations": [
    {
      "type": "map",
      "source": "input.items",
      "transform": {
        "id": "item.id",
        "name": "item.product_name",
        "total": "item.price * item.quantity"
      }
    },
    {
      "type": "filter",
      "condition": "item.total > 100"
    }
  ]
}

Operations

OperationDescription
mapTransform each item
filterKeep items matching condition
reduceAggregate values
pickSelect specific fields
omitRemove specific fields
flattenFlatten nested arrays

Set Variables

Store values for later use.

Configuration

json
{
  "type": "set_variables",
  "variables": {
    "order_total": "{{ nodes.calculate.result.total }}",
    "is_premium": "{{ input.customer.tier == 'premium' }}",
    "timestamp": "{{ now() }}"
  }
}

Access Variables

javascript
{{ variables.order_total }}
{{ variables.is_premium }}

Error Handling

Each action can have error handling:

json
{
  "type": "http_request",
  "url": "...",
  "on_error": {
    "action": "continue",
    "default_output": {
      "status": "failed",
      "error": "{{ error.message }}"
    }
  }
}

Error Actions

ActionDescription
stopStop workflow execution
continueContinue with default output
retryRetry the action
branchGo to error handler node

Next Steps