Stream session to Slack

Pipe veirox logs --follow --plain through a shell loop to post each log line to a Slack incoming webhook.

Prerequisites

  • A Slack incoming webhook URL stored as SLACK_WEBHOOK.
  • curl and jq available on the machine.

Steps

#!/usr/bin/env bash
# stream-to-slack.sh <session-id>
SESSION_ID="$1"

veirox logs "$SESSION_ID" --follow --plain | while IFS= read -r line; do
  payload=$(jq -Rn --arg t "$line" '{text: $t}')
  curl -s -X POST "$SLACK_WEBHOOK" -H 'Content-type: application/json' --data "$payload" > /dev/null
  sleep 0.5   # stay inside Slack's 1 msg/s rate limit
done
bash stream-to-slack.sh <session-id>

Common pitfalls

  • Rate limits: Slack webhooks allow ~1 message/second. The sleep 0.5 guard above keeps you safe for most sessions.
  • Noisy output: use --plain to suppress ANSI colour codes before piping.

See also