Pilot Webhook Bridge

v1.0.0

Forward Pilot Protocol events to HTTP webhooks for Slack, Discord, PagerDuty, and custom integrations. Use this skill when: 1. You need to forward Pilot even...

0· 141· 1 versions· 0 current· 0 all-time· Updated 6h ago· MIT-0
byCalin Teodor@teoslayer

Install

openclaw skills install pilot-webhook-bridge

pilot-webhook-bridge

Forward Pilot Protocol events (port 1002) to HTTP webhooks for integration with Slack, Discord, Microsoft Teams, PagerDuty, and custom HTTP endpoints.

Commands

Configure global webhook

pilotctl --json set-webhook <webhook-url>

All events on port 1002 are forwarded as HTTP POST with JSON payload.

Clear webhook

pilotctl --json clear-webhook

Subscribe and forward (selective)

pilotctl --json subscribe <source-hostname> <topic> --timeout <seconds> | \
  jq -c '.data.events[]' | \
  while IFS= read -r event; do
    curl -X POST <webhook-url> -H "Content-Type: application/json" -d "$event"
  done

Workflow: Slack Integration

SOURCE="production-app"
TOPIC="alerts.*"
SLACK_WEBHOOK="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
TIMEOUT=600

pilotctl --json subscribe "$SOURCE" "$TOPIC" --timeout "$TIMEOUT" | \
  jq -c '.data.events[]' | \
  while IFS= read -r event; do
    topic=$(echo "$event" | jq -r '.topic')
    message=$(echo "$event" | jq -r '.data.message // .')
    severity=$(echo "$event" | jq -r '.data.severity // "info"')

    # Map severity to color
    case "$severity" in
      critical|error) color="danger" ;;
      warning) color="warning" ;;
      *) color="good" ;;
    esac

    # Build Slack payload
    slack_payload=$(jq -n \
      --arg text "Pilot Event: $topic" \
      --arg msg "$message" \
      --arg color "$color" \
      '{
        text: $text,
        attachments: [{
          color: $color,
          fields: [{title: "Message", value: $msg, short: false}]
        }]
      }')

    curl -X POST "$SLACK_WEBHOOK" \
      -H "Content-Type: application/json" \
      -d "$slack_payload" \
      --silent --show-error
  done

Workflow: Discord Integration

DISCORD_WEBHOOK="https://discord.com/api/webhooks/YOUR/WEBHOOK"

pilotctl --json subscribe "$SOURCE" "$TOPIC" --timeout 300 | \
  jq -c '.data.events[]' | \
  while IFS= read -r event; do
    topic=$(echo "$event" | jq -r '.topic')
    value=$(echo "$event" | jq -r '.data.value // .data')

    discord_payload=$(jq -n \
      --arg title "Metric: $topic" \
      --arg value "$value" \
      '{
        embeds: [{
          title: $title,
          description: "Value: " + $value,
          color: 3447003
        }]
      }')

    curl -X POST "$DISCORD_WEBHOOK" \
      -H "Content-Type: application/json" \
      -d "$discord_payload" \
      --silent --show-error
  done

Dependencies

Requires pilot-protocol skill, curl, jq, running daemon, and trust relationships with source agents.

Version tags

latestvk97f70q3w0cs4rsvcme6b67p6x84hb54

Runtime requirements

Binspilotctl, curl, jq