Workflows

Workflow examples

Seven complete sochub workflows, from Slack notifications to scheduled vendor pulls and task automation, with every trigger, filter and field value.

Each example lists the trigger and filter, the graph, and the settings of each node. Node ids are in code; later steps refer to them as steps.<id>.output. Field names match the editor’s Inspector.

Build them on the Workflows page, save, try a Dry run, then enable. For the node reference see Workflow nodes; for expressions see Filters, templates and pulling data.

1. Notify Slack when a critical case is created

Goal: post every new critical case to the SOC channel, with buttons to acknowledge, assign or close it from Slack.

Trigger: Case created Filter:

case.severity == 'critical'

Graph

Trigger → notify

notify (Slack message)

  • Channel: #soc-critical

  • Message (mrkdwn):

    :rotating_light: *Critical case #{{ case.id }}*: {{ case.title }}
    Tags: {{ case.tags | join(', ') or 'none' }}
  • Case buttons: yes

What happens: when a critical case is created, by an analyst or by a workflow promoting an alert, the message is posted with the case buttons. Cases created at another severity don’t start a run. The Slack integration must be connected and the bot invited to #soc-critical.

2. Promote identity alerts to a case and add artifacts

Goal: alerts from the identity provider webhook about impossible travel become cases, with the user name added as an artifact and a short note.

The alerts arrive through a webhook named IdP (an alert’s source is the webhook’s name), with a payload like:

{"event_type": "impossible_travel", "user": {"name": "alice", "email": "alice@example.com"},
 "src_ip": "203.0.113.7", "country": "BR"}

Trigger: Alert ingested Filter:

alert.source == 'IdP' and alert.payload.get('event_type') == 'impossible_travel' and (alert.payload.get('user') or {}).get('name', '') != ''

Graph

Trigger → promote → user → note

promote (Promote alert)

  • Mode: new
  • Case title: Impossible travel: {{ alert.payload.user.name }}
  • Severity: high
  • Tags: identity, impossible-travel

user (Add artifact)

  • Type: username
  • Value: {{ alert.payload.user.name }}
  • Description: From alert {{ alert.external_id }}

note (Add note)

  • Note: Sign-in from {{ alert.payload.get('country', 'unknown') }} ({{ alert.payload.get('src_ip', 'no IP') }}). Check with the user before resetting credentials.

What happens: the alert becomes a new case and is marked promoted. Promotion already copies IP addresses, emails, URLs, domains and hashes it finds in the payload onto the case (here 203.0.113.7 and alice@example.com), so you only add what the automatic extraction can’t find, like the user name. After promote, the case nodes act on the new case. The new case also starts any Case created workflows, such as example 1 if it is critical.

The filter checks that user.name exists, so {{ alert.payload.user.name }} is safe in the steps. Alerts that don’t match stay pending in the Alerts list.

3. Enrich every IP on a case

Goal: an analyst runs one workflow that looks up each IP artifact of the case in a threat-intel API and adds a note per IP.

Before you start: in Settings → Integrations → Secrets, add INTEL_API_KEY with allowed host intel.example.com.

Trigger: Manual (no filter)

Graph

Trigger → has_ips ─true──→ each_ip [ lookup → note ] → summary
                  └─false─→ no_ips

has_ips (Condition)

  • Expression: case.attributes_all.get('ip', []) | length > 0

each_ip (For each), connected from the true output of has_ips

  • Items: case.attributes_all.get('ip', [])
  • Concurrency: 5
  • Max items: 50
  • Continue on error: ticked, so one failed lookup doesn’t fail the run

Inside the each_ip box:

lookup (HTTP request)

  • Method: GET

  • URL: https://intel.example.com/api/v1/ip/{{ loop.item }}

  • Headers (JSON):

    {"X-API-Key": "{{ secrets.INTEL_API_KEY }}", "Accept": "application/json"}

note (Add note), connected from lookup

  • Note:

    Enrichment for {{ loop.item }} (HTTP {{ steps.lookup.output.status }}): {{ steps.lookup.output.body.get('verdict', 'unknown') if steps.lookup.output.body is mapping else 'not JSON' }}

After the loop:

summary (Add note), connected from each_ip

  • Note: IP enrichment done: {{ steps.each_ip.output.succeeded }} of {{ steps.each_ip.output.results | length }} lookups succeeded.

no_ips (Add note), connected from the false output of has_ips

  • Note: IP enrichment skipped: the case has no IP artifacts.

What happens: run it from the case’s Automation tab. Each IP gets its own child run, up to five at a time, and its own note, for example [automation] Enrichment for 203.0.113.7 (HTTP 200): malicious. A 404 from the API does not fail the lookup; the note shows the status. When all IPs are done, summary counts the results.

To run it automatically instead, change the trigger to Case created. To loop over several artifact types, use case.artifacts | selectattr('type', 'in', ['ip', 'domain']) | map(attribute='value') | list as the items.

4. Page and tag when a case escalates to critical

Goal: when someone raises a case to critical, page the on-call engineer through PagerDuty, tell the SOC channel, and tag the case.

Before you start: add the secret PAGERDUTY_ROUTING_KEY (the Events API v2 integration key) with allowed host events.pagerduty.com.

Trigger: Case updated Filter:

'severity' in trigger.changes and trigger.changes.severity.to == 'critical'

Graph

Trigger → notify → page → tag

notify (Slack message)

  • Channel: #soc-critical
  • Message (mrkdwn): :arrow_double_up: Case #{{ case.id }} escalated from {{ trigger.changes.severity.from }} to critical: *{{ case.title }}*
  • Case buttons: yes

page (HTTP request)

  • Method: POST

  • URL: https://events.pagerduty.com/v2/enqueue

  • Headers (JSON): {"Content-Type": "application/json"}

  • Body (JSON):

    {
      "routing_key": "{{ secrets.PAGERDUTY_ROUTING_KEY }}",
      "event_action": "trigger",
      "dedup_key": "sochub-case-{{ case.id }}",
      "payload": {
        "summary": "Case #{{ case.id }} escalated to critical: {{ case.title | truncate(150, True) }}",
        "source": "sochub",
        "severity": "critical"
      }
    }
  • Continue on error: ticked, so a paging problem still lets the case be tagged

tag (Update case)

  • Add tags: escalated

What happens: only updates that change the severity to critical start a run; other edits don’t. tag updates the case, which fires Case updated again, but that change is to the tags, not the severity, so this workflow doesn’t run a second time.

If the page fails, the error is in steps.page.output.error on the run page. PagerDuty answers 202 when it accepts the event; a 4xx answer is in steps.page.output.status.

5. Pull alerts from a vendor API every 10 minutes

Goal: fetch new alerts from a vendor’s REST API on a schedule and create a sochub alert for each one, without duplicates.

Before you start: add the secret VENDOR_API_TOKEN with allowed host api.vendor.example.

Trigger: Schedule (cron, UTC) Cron expression: */10 * * * *

The API in this example answers {"alerts": [{"id": "...", "title": "...", "severity": "HIGH", ...}]}.

Graph

Trigger → pull → ok ─true──→ each [ create ]
                    └─false─→ failed

pull (HTTP request)

  • Method: GET

  • URL: https://api.vendor.example/v1/alerts?since={{ trigger.since | urlencode }}&limit=200

  • Headers (JSON):

    {"Authorization": "Bearer {{ secrets.VENDOR_API_TOKEN }}", "Accept": "application/json"}

ok (Condition)

  • Expression: steps.pull.output.status == 200

each (For each), connected from the true output of ok

  • Items: steps.pull.output.body.get('alerts', []) if steps.pull.output.body is mapping else []
  • Concurrency: 5
  • Max items: 200

Inside the each box:

create (Create alert)

  • Source: vendor
  • External ID: {{ loop.item.id }}
  • Title: {{ loop.item.get('title', 'Vendor alert') }}
  • Severity: {{ (loop.item.get('severity') or 'medium') | lower }}
  • Payload: loop.item

failed (Fail run), connected from the false output of ok

  • Message: Vendor pull failed: HTTP {{ steps.pull.output.status }}

What happens: every 10 minutes the run asks the API for alerts since trigger.since, the time of the last successful run (minus a short overlap). Each alert becomes a pending sochub alert with source vendor. Alerts seen twice because of the overlap are not created again. If the API answers 401 or 429, the run fails with the status, and the next run reads the same window again.

Keep the API’s page size (limit=200) at or below Max items: a longer list fails the loop step. To handle the new alerts, add an Alert ingested workflow with the filter alert.source == 'vendor', like example 2 or 7.

6. Ask the user on Slack from a case task

Goal: a playbook task Confirm the activity with the user runs a workflow that asks the affected user on Slack and records the answer on the task.

Before you start:

  • Connect Slack (Settings → Integrations).
  • In Settings → Artifact types, create a custom type with key user_email. If alerts carry the user’s address, set its payload key (for example user.email) so promotion fills it in; analysts can also add it by hand.

Trigger: Manual (no filter). Name the workflow Confirm activity with user.

Graph

Trigger → has_user ─true──→ ask → record → confirmed ─false─→ escalate
                   └─false─→ no_user

has_user (Condition)

  • Expression: case.attributes.get('user_email', '') != ''

ask (Ask user (Slack)), from the true output of has_user

  • User email: {{ case.attributes.user_email }}
  • Question (mrkdwn): Hi, your security team is reviewing recent activity on your account (case: {{ case.title }}). Was this you?
  • Buttons: It was me, It wasn't me
  • Timeout (hours): 4

record (Complete task)

  • Result:

    {{ ('No answer from ' ~ steps.ask.output.email ~ ' within the time limit') if steps.ask.output.timed_out else (steps.ask.output.email ~ ' answered "' ~ steps.ask.output.response ~ '" on Slack') }}
  • Result status:

    {{ 'warning' if steps.ask.output.timed_out else ('ok' if steps.ask.output.response == 'It was me' else 'failed') }}
  • Tick the task: {{ not steps.ask.output.timed_out }}

confirmed (Condition)

  • Expression: not steps.ask.output.timed_out and steps.ask.output.response == 'It was me'

escalate (Update case), from the false output of confirmed

  • Severity: high
  • Add tags: user-not-confirmed

no_user (Complete task), from the false output of has_user

  • Result: No user to ask: add a user_email artifact to the case.
  • Result status: failed
  • Tick the task: false

Link it to the task:

  1. Save and enable the workflow.
  2. In Playbooks, edit the playbook and, on the task Confirm the activity with the user, choose Run workflow: Confirm activity with user.
  3. Apply the playbook to a case. On the case’s Tasks tab, the task shows the workflow and a Run button.

What happens: the analyst clicks Run on the task. The user gets a Slack DM with two buttons and the run waits. Then record writes the result on that same task:

User Task result Status Task
Clicks It was me alice@example.com answered “It was me” on Slack ok ticked
Clicks It wasn’t me alice@example.com answered “It wasn’t me” on Slack failed ticked, and the case is raised to high and tagged
No answer in 4 hours No answer from alice@example.com within the time limit warning left open, and the case is raised to high and tagged
No user_email on the case No user to ask: … failed left open

The task’s Last run link opens the run. For users who aren’t on Slack, use Ask user (email) with the same fields instead. sochub also ships a ready-made version of this workflow in Workflows → Templates (Ask the user on Slack to confirm (for a case task)).

7. Branch on alert severity: group or dismiss

Goal: EDR alerts with severity 7 or more are grouped into one case per host over six hours; lower ones are dismissed with a reason.

Trigger: Alert ingested Filter:

alert.source == 'EDR'

Graph

Trigger → severe ─true──→ promote → note
                 └─false─→ dismiss

severe (Condition)

  • Expression: (alert.payload.get('severity') or 0) >= 7

promote (Promote alert), from the true output

  • Mode: group
  • Case title: EDR activity on {{ alert.payload.get('host', 'unknown host') }}
  • Severity: high
  • Tags: edr
  • Group key: host:{{ alert.payload.get('host', 'unknown') }}
  • Group window (hours): 6

note (Add note)

  • Note: Alert {{ alert.external_id }} added ({{ 'new case' if steps.promote.output.created else 'existing case' }})

dismiss (Dismiss alert), from the false output

  • Reason: auto: EDR severity {{ alert.payload.get('severity') or 'missing' }} is below 7

What happens: the first severe alert for host web-1 creates a case; later severe alerts for web-1 within six hours join that case instead of opening new ones, and each adds a note saying which. Alerts arriving at the same moment still end up in one case. Alerts below 7, or without a severity, take the false branch and are dismissed with the reason. The step on the branch not taken shows as skipped on the run page.

Dry-run it against a pending EDR alert to check both branches: the promote and dismiss steps are simulated, and would do shows the rendered group key, for example host:web-1.

Found a mistake? Edit this page or open an issue on GitHub.