Post

Outgoing WebHook

Send HTTP requests to external systems for integration and notifications.

Outgoing WebHook

Outgoing WebHook: External System Integration

The Outgoing WebHook Executor enables your Krill automation to communicate with external systems by sending HTTP requests. This is essential for integrations, notifications, data export, and connecting Krill to cloud services, APIs, and third-party platforms.

Info: This is an Executor node type that can be executed to perform work by the execution of a parent node. When triggered, it sends an HTTP request to the configured endpoint.

Info: This feature uses TargetingNodeMetaData, which means it can be configured to read data from source nodes (Data Points) and include that data in the HTTP request body or parameters.

Overview

Outgoing WebHooks act as a bridge between your local Krill automation and the wider internet. Whether you’re sending alerts to Slack, logging data to cloud databases, triggering actions in other systems, or integrating with IoT platforms, Outgoing WebHooks provide the connectivity you need.

Key Features

  • Full HTTP Method Support: GET, POST, PUT, DELETE, PATCH
  • Custom Headers: Add authentication tokens, content types, custom headers
  • Request Body: Send JSON, form data, or custom payloads
  • Source Data Integration: Include data from source Data Points
  • URL Parameters: Dynamic URLs with variable substitution
  • Async Execution: Non-blocking HTTP requests
  • Error Handling: Comprehensive error logging and reporting
  • TLS/SSL Support: Secure HTTPS connections

WebHook Request Flow

graph TD
    A[Parent Executor Triggers] --> B[Read Source Data Points]
    B --> C[Build HTTP Request]
    C --> D[Add Headers & Auth]
    D --> E[Prepare Request Body]
    E --> F[Send HTTP Request]
    F --> G{Response OK?}
    G -->|Yes| H[Log Success]
    G -->|No| I[Log Error]
    H --> J[Execute Children]
    I --> J

How It Works

When an Outgoing WebHook executes:

  1. Trigger: Parent node (trigger, executor, or manual) activates the webhook
  2. Data Collection: Reads values from source data points if configured
  3. Request Building: Constructs HTTP request with method, URL, headers, body
  4. Data Integration: Includes source data in request body or parameters
  5. Execution: Sends HTTP request to external endpoint
  6. Response Handling: Processes response, logs success or errors
  7. Child Execution: Triggers child executors if configured

Supported HTTP Methods

MethodUse CaseBody Support
GETRetrieve data, trigger actionsNo
POSTCreate resources, send dataYes
PUTUpdate resourcesYes
PATCHPartial updatesYes
DELETERemove resourcesOptional

Configuration

FieldDescriptionRequired
urlTarget endpoint URLYes
methodHTTP method (GET, POST, etc.)Yes
headersCustom HTTP headers (JSON object)No
bodyRequest body contentNo
sourcesData point IDs to include in requestNo

Use Cases

  • Alerting & Notifications: Send alerts to Slack, Discord, email services
  • Data Export: Push sensor data to cloud databases or analytics platforms
  • System Integration: Trigger actions in other automation systems
  • Cloud Logging: Send events to logging services (Splunk, Datadog, etc.)
  • IoT Platform Integration: Connect to AWS IoT, Azure IoT, Google Cloud IoT
  • Webhook Chains: Trigger webhooks in other services (IFTTT, Zapier)
  • Monitoring: Send health checks and status updates
  • API Calls: Interact with REST APIs for various services

Example Workflows

Slack Alert on High Temperature:

  1. Trigger: High Threshold (Temperature > 80°C)
  2. Executor: Outgoing WebHook
    • URL: https://hooks.slack.com/services/YOUR/WEBHOOK/URL
    • Method: POST
    • Body: {"text": "⚠️ High temperature alert: {{temperature}}°C"}

Log Sensor Data to Cloud:

  1. Trigger: Cron Timer (every 5 minutes)
  2. Executor: Calculation (aggregate sensor data)
  3. Executor: Outgoing WebHook
    • URL: https://api.example.com/sensor-data
    • Method: POST
    • Headers: {"Authorization": "Bearer YOUR_TOKEN"}
    • Body: {"timestamp": "{{timestamp}}", "value": "{{value}}"}

Trigger IFTTT Applet:

  1. Trigger: Button or Threshold
  2. Executor: Outgoing WebHook
    • URL: https://maker.ifttt.com/trigger/event_name/with/key/YOUR_KEY
    • Method: POST
    • Body: {"value1": "{{data}}"}

Update External Dashboard:

  1. Trigger: Data Point Update
  2. Executor: Outgoing WebHook
    • URL: https://dashboard.example.com/api/update
    • Method: PUT
    • Body: Current sensor readings

Authentication Examples

Bearer Token:

1
2
3
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

API Key:

1
2
3
{
  "X-API-Key": "your-api-key-here"
}

Basic Auth:

1
2
3
{
  "Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
}

Request Body Formats

JSON:

1
2
3
4
5
6
{
  "sensor": "temperature",
  "value": 75.5,
  "unit": "fahrenheit",
  "timestamp": 1643652000
}

Form Data:

1
sensor=temperature&value=75.5&unit=fahrenheit

Variable Substitution

When sources are configured, you can include source data in your request:

  • {{value}} - Current value from source data point
  • {{timestamp}} - Timestamp from source data point
  • Custom variables based on your source configuration

Integration Points

  • Data Points: Include sensor values in webhook payloads
  • Triggers: Send webhooks when conditions are met
  • Calculations: Send computed results to external systems
  • Lambda: Combine with Python scripts for complex payloads
  • Logic Gates: Conditional webhook sending

Best Practices

  • Authentication: Always use secure authentication (API keys, tokens)
  • HTTPS: Use encrypted connections for sensitive data
  • Error Handling: Monitor webhook execution logs for failures
  • Rate Limiting: Be mindful of external API rate limits
  • Timeouts: Ensure external endpoints respond quickly
  • Retry Logic: Consider implementing retries for critical webhooks
  • Data Privacy: Don’t send sensitive data to untrusted endpoints
  • Testing: Test webhooks thoroughly before production use

Common Integrations

ServiceMethodUse Case
SlackPOSTTeam notifications
DiscordPOSTCommunity alerts
AWS IoTPOSTCloud data ingestion
DatadogPOSTMetrics and events
IFTTTPOSTApplet triggers
ZapierPOSTWorkflow automation
InfluxDBPOSTTime-series data
ElasticsearchPOSTLog aggregation

Outgoing WebHooks are the essential connector that brings Krill automation into the broader ecosystem of cloud services and external platforms.

This post is licensed under CC BY 4.0 by the author.