Skip to main content

Reference: Cron Config, Webhook Setup, and Slack Integration

Quick-reference for Module 12 — configuring automated triggers and interfaces in Hermes.


1. Hermes Cron Job Configuration

Cron jobs are defined in the agent's config.yaml under the schedules key.

Basic Cron Job

schedules:
daily_db_health:
schedule: "0 7 * * *" # Daily at 07:00 UTC
task: "Run daily DB health check: review slow queries from last 24 hours, identify top 5 by total_exec_time, flag any queries with execution time > 1000ms average"
output:
channel: slack
target: "#platform-alerts"
format: markdown
include_confidence: true
on_error:
notify: "#platform-oncall"
retry: false # Don't retry on failure — wait for next scheduled run

Cron Job with Conditional Alert

schedules:
hourly_cost_check:
schedule: "0 * * * *" # Every hour
task: "Check AWS cost-per-hour against yesterday's baseline. Alert only if current hour exceeds baseline by more than 20%."
output:
channel: slack
target: "#finops-alerts"
format: markdown
only_if: "anomaly_detected" # Only post if agent identifies an anomaly
on_normal:
log_only: true # Log to file, don't post to Slack when normal

Cron Job Parameters

ParameterValuesDescription
scheduleCron expressionStandard 5-field cron (minute hour day month weekday)
taskStringTask description sent to agent
output.channelslack, email, log, webhookWhere output goes
output.targetChannel name, email address, URLDestination within channel
output.formatmarkdown, json, plainOutput format
output.only_ifanomaly_detected, alert_triggered, alwaysConditional posting
on_error.notifySlack channel or emailWhere to send error notification
on_error.retrytrue/falseWhether to retry on failure

Common Cron Expressions

ScheduleExpression
Daily at 07:00 UTC0 7 * * *
Every hour0 * * * *
Every 30 minutes*/30 * * * *
Weekdays at 08:00 UTC0 8 * * 1-5
Monday at 09:00 UTC0 9 * * 1
First of month at midnight0 0 1 * *

2. Webhook Subscription Configuration

Webhooks are configured in Hermes to listen for specific events from external systems.

Basic Webhook

webhooks:
cloudwatch_alarm:
path: "/webhooks/cloudwatch"
method: POST
validation:
type: hmac_sha256
secret_env_var: "CLOUDWATCH_WEBHOOK_SECRET"
payload_mapping:
alarm_name: "$.AlarmName"
metric_name: "$.Trigger.MetricName"
db_instance: "$.Trigger.Dimensions[?(@.name=='DBInstanceIdentifier')].value"
state: "$.NewStateValue"
timestamp: "$.StateChangeTime"
task_template: |
ALARM: {alarm_name} is in state {state} as of {timestamp}.
Investigate {db_instance} for {metric_name} issues.
Time window: last 30 minutes before {timestamp}.
route_to_agent: "rds-health-agent"
output:
channel: slack
target: "#db-alerts"

Payload Mapping JSONPath Reference

JSONPath ExpressionPurpose
$.AlarmNameCloudWatch alarm name
$.Trigger.MetricNameMetric that triggered the alarm
$.Trigger.Dimensions[0].valueFirst dimension value (e.g., instance ID)
$.NewStateValueNew alarm state (ALARM, OK, INSUFFICIENT_DATA)
$.StateChangeTimeISO 8601 timestamp of state change

PagerDuty Webhook

webhooks:
pagerduty_incident:
path: "/webhooks/pagerduty"
method: POST
validation:
type: x_pagerduty_signature
secret_env_var: "PAGERDUTY_WEBHOOK_SECRET"
payload_mapping:
incident_id: "$.messages[0].incident.id"
title: "$.messages[0].incident.title"
severity: "$.messages[0].incident.urgency"
created_at: "$.messages[0].incident.created_at"
task_template: |
PagerDuty incident {incident_id}: {title}
Severity: {severity}, Created: {created_at}
Run cross-domain investigation across all infrastructure domains.
route_to_agent: "incident-coordinator"
output:
channel: pagerduty
target: "{incident_id}" # Append findings to the PagerDuty incident

3. Slack Integration Overview

Slack integration in Hermes has two modes:

  1. Outbound: Agent posts findings to Slack channels (configured in cron and webhook output)
  2. Inbound (slash command): Humans invoke the agent via Slack slash command

Outbound Configuration

integrations:
slack:
workspace: "your-workspace"
auth_env_var: "SLACK_BOT_TOKEN"
default_channel: "#platform-agents"
message_format: markdown
include_timestamp: true
include_agent_name: true

Inbound (Slash Command) — Overview

Slash command integration requires a Slack App with slash command configuration. This is a demo walkthrough in the lab, not hands-on configuration (requires workspace admin access):

  1. Create a Slack App in your workspace (requires admin)
  2. Add slash command: /hermes → POST to https://your-hermes-host/slack/commands
  3. Configure Hermes with the Slack signing secret
  4. Users can then run: /hermes investigate db-prod-01 slow queries

In the lab: The facilitator demonstrates slash command usage on the training workspace. Participants observe the interaction pattern; actual slash command setup requires workspace admin access that most participants do not have in training environments.


4. Output Routing Reference

Where agent output goes is as important as what the agent produces.

ScenarioOutput Routing
Scheduled health reportSlack channel (always post, even if no findings)
Alert-triggered diagnosisBack to the alert ticket (PagerDuty comment, CloudWatch annotation)
On-call investigationDirect Slack message to on-call user
Weekly trend summaryEmail distribution list
Approval-required actionSlack with approval buttons (Module 13)

Structured Output Format for Routing

Agents posting to external channels should use structured output that renders well in the target medium:

## DB Health: db-prod-01 — 2026-04-01 07:00 UTC

**Status:** ELEVATED (requires monitoring)
**Top Finding:** Slow query average exec time increased 40% vs. 7-day baseline

**Evidence:**
- Top query by exec time: `SELECT * FROM orders WHERE...` (avg 450ms, +180ms vs. baseline)
- Connection pool: 45/100 (45%, within normal range)
- CPU: 32% average (normal)

**Recommendation:** Review query plan for orders table query. Consider adding index on `created_at` column.

**Escalation:** None — monitor trend, report again tomorrow at 07:00 UTC.

*Hermes DB Health Agent | Skill: rds-health-v1.2 | 14:23 elapsed*

This format renders correctly in Slack markdown and provides all information needed to act without clicking through to additional context.


5. Trigger Decision Matrix

FactorUse CronUse WebhookUse CLI
Human must triggerNoNoYes
Needs to respond to eventsNoYesNo
Scheduled at fixed intervalsYesNoNo
Needs human context in taskNoNoYes
Best for trending dataYesNoNo
Best for incident responseNoYesYes (fallback)