Overview

Advanced Input Tools provide specialized input capabilities for handling different types of data sources including webhooks, Slack events, image files, and text files. These tools are essential for building comprehensive workflows that integrate with external systems.

Key Features

INPUT_WEBHOOK

  • Receive webhook requests from various services
  • Handle HTTP POST requests to your publishable URL
  • Parse JSON and form data automatically
  • Essential for API integrations

INPUT_SLACK_EVENT

  • Receive Slack App event subscriptions
  • Handle real-time Slack workspace events
  • Process messages, reactions, and user interactions
  • Requires Slack App configuration

INPUT_IMAGE_FILE

  • Input image files from direct download URLs
  • Convert images to base64-encoded strings
  • Support for various image formats
  • Optimized for AI processing workflows

INPUT_FILE_AS_TEXT

  • Input text files from URLs
  • Support for multiple text formats (CSV, JSON, XML, YAML, HTML)
  • Return presigned URLs for file access
  • Automatic encoding detection

Setup Instructions

Note: INPUT_ tools are crucial for MCP (Model Context Protocol) and API integrations. Their IDs must match exactly in your MCP configuration and API endpoints.

Example: Webhook Processing Workflow

- id: receive_webhook
  name: receive_webhook
  tool: INPUT_WEBHOOK
  input:
    - name: description
      value: "Receive order notification from e-commerce platform"
    - name: use_as_input
      value: true

- id: process_order
  name: process_order
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Process this order data and extract key information:
        {{steps.receive_webhook.result.body}}
        
        Extract: customer info, order items, total amount, shipping details

Example: Slack Event Processing

- id: slack_listener
  name: slack_listener
  tool: INPUT_SLACK_EVENT
  input:
    - name: description
      value: "Listen for mention events in Slack"
    - name: use_as_input
      value: true

- id: respond_to_mention
  name: respond_to_mention
  tool: SLACK_POST_MESSAGE
  input:
    - name: channel
      value: "{{steps.slack_listener.result.channel}}"
    - name: text
      value: "Thanks for mentioning me! I'll process your request."

Example: Image Analysis Pipeline

- id: input_image
  name: input_image
  tool: INPUT_IMAGE_FILE
  input:
    - name: file_url
      value: "https://example.com/image.jpg"
    - name: description
      value: "Product image for analysis"

- id: analyze_image
  name: analyze_image
  tool: GEMINI_INVOKE_WITH_IMAGE
  config:
    - name: version
      value: gemini-1.5-flash
  input:
    - name: prompt
      value: "Analyze this product image and describe its features"
    - name: base64_image
      value: "{{steps.input_image.result.base64_content}}"

Example: Text File Processing

- id: input_config_file
  name: input_config_file
  tool: INPUT_FILE_AS_TEXT
  input:
    - name: value
      value: "https://example.com/config.json"
    - name: description
      value: "Configuration file for processing"
    - name: use_as_input
      value: true

- id: parse_configuration
  name: parse_configuration
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        import json
        import requests
        
        # Download and parse the config file
        file_url = "{{steps.input_config_file.result}}"
        response = requests.get(file_url)
        config = json.loads(response.text)
        
        print("Configuration loaded:")
        for key, value in config.items():
            print(f"  {key}: {value}")
        
        # Extract specific settings
        database_url = config.get('database_url', 'Not found')
        api_key = config.get('api_key', 'Not found')
        
        print(f"\nDatabase URL: {database_url}")
        print(f"API Key: {'*' * len(api_key) if api_key != 'Not found' else 'Not found'}")

- id: validate_config
  name: validate_config
  tool: CHECKER_CHECK_BY_JSON
  input:
    - name: text
      value: "{{steps.parse_configuration.result.stdout | join(' ')}}"
    - name: task_name
      value: "Configuration Validation"
    - name: rules
      value: |
        [
          {
            "rule": "Database URL present",
            "pattern": "database_url.*://",
            "required": true
          },
          {
            "rule": "API key configured",
            "pattern": "api_key.*\\*+",
            "required": true
          }
        ]

Example: CSV Data Import

- id: import_csv_data
  name: import_csv_data
  tool: INPUT_FILE_AS_TEXT
  input:
    - name: value
      value: "https://example.com/sales_data.csv"
    - name: description
      value: "Monthly sales data CSV file"

- id: process_csv
  name: process_csv
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        import csv
        import requests
        from io import StringIO
        
        # Download CSV file
        file_url = "{{steps.import_csv_data.result}}"
        response = requests.get(file_url)
        csv_content = response.text
        
        # Parse CSV
        csv_reader = csv.DictReader(StringIO(csv_content))
        rows = list(csv_reader)
        
        print(f"Loaded {len(rows)} rows from CSV")
        print(f"Columns: {', '.join(csv_reader.fieldnames)}")
        
        # Calculate summary statistics
        if 'amount' in csv_reader.fieldnames:
            amounts = [float(row['amount']) for row in rows if row['amount']]
            total = sum(amounts)
            average = total / len(amounts) if amounts else 0
            
            print(f"\nSales Summary:")
            print(f"  Total Sales: ${total:,.2f}")
            print(f"  Average Sale: ${average:,.2f}")
            print(f"  Number of Sales: {len(amounts)}")

- id: generate_report
  name: generate_report
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Based on the following CSV processing results, generate a sales report:
        
        {{steps.process_csv.result.stdout | join('\n')}}
        
        Please create a markdown report with:
        1. Executive summary
        2. Key metrics
        3. Trends and insights
        4. Recommendations

File Format Support

INPUT_FILE_AS_TEXT Supported Formats:

  • text/plain: Plain text files (.txt)
  • text/csv: Comma-separated values (.csv)
  • text/html: HTML documents (.html)
  • text/xml: XML documents (.xml)
  • text/json: JSON files (.json)
  • text/yaml: YAML configuration files (.yml, .yaml)

Use Cases

  • API Integration: Receive data from external services via webhooks
  • Real-time Processing: Handle Slack events and notifications
  • Image Processing: Analyze images with AI models
  • Document Processing: Handle text files and documents
  • Event-driven Workflows: Trigger workflows based on external events