id: saas-status-incident-watch-ai-impact
namespace: company.team
description: |
Poll the public status pages of the SaaS vendors your product depends on, detect new
incidents and new incident updates, and post a Slack alert where Gemini explains what the
incident likely means for your own product, based on how you use each vendor.
inputs:
- id: vendors
type: JSON
displayName: Vendors to watch
description: List of objects with a unique key (letters, digits, - and _), a
name, an Atlassian Statuspage base URL and how you use the vendor.
defaults: |
[
{"key": "github", "name": "GitHub", "status_url": "https://www.githubstatus.com", "usage": "Source code hosting, pull requests and GitHub Actions for CI/CD."},
{"key": "cloudflare", "name": "Cloudflare", "status_url": "https://www.cloudflarestatus.com", "usage": "DNS, CDN and WAF in front of our public web app and API."},
{"key": "claude", "name": "Anthropic Claude", "status_url": "https://status.claude.com", "usage": "Claude API powers the AI assistant feature in our product."},
{"key": "vercel", "name": "Vercel", "status_url": "https://www.vercel-status.com", "usage": "Hosts our marketing site and customer dashboard frontend."},
{"key": "stripe", "name": "Stripe", "status_url": "https://www.stripestatus.com", "usage": "Card payments, subscriptions and invoices."}
]
- id: product_context
type: STRING
displayName: Product context
description: One or two sentences about your product, used to judge customer impact.
defaults: A B2B SaaS web app with an AI assistant, used by customers in Europe
and the US during business hours.
- id: model_name
type: STRING
displayName: Gemini model
defaults: gemini-2.5-flash
tasks:
- id: for_each_vendor
type: io.kestra.plugin.core.flow.Loop
description: Check every vendor independently, three at a time. One unreachable
status page does not hide the others.
values: "{{ inputs.vendors }}"
concurrencyLimit: 3
tasks:
- id: fetch_incidents
type: io.kestra.plugin.core.http.Download
description: Unresolved incidents from the vendor's public Statuspage API (no key).
uri: "{{ fromJson(item.value).status_url }}/api/v2/incidents/unresolved.json"
headers:
User-Agent: Kestra-SaaS-Status-Watch
- id: load_known
type: io.kestra.plugin.core.kv.Get
description: Load the incident updates already reported for this vendor.
key: "status_watch_{{ fromJson(item.value).key }}"
errorOnMissing: false
- id: find_new_updates
type: io.kestra.plugin.scripts.python.Script
description: Keep only incidents that are new or have a new update since the
last run.
containerImage: python:3.12-slim
inputFiles:
incidents.json: "{{ outputs.fetch_incidents.uri }}"
known.json: "{{ (outputs.load_known.value ?? {}) | toJson }}"
script: |
import json
with open("incidents.json") as f:
incidents = json.load(f).get("incidents", [])
with open("known.json") as f:
known = json.load(f) or {}
if isinstance(known, str):
known = json.loads(known)
fresh, now_known = [], {}
for inc in incidents:
updates = sorted(inc.get("incident_updates", []), key=lambda u: u.get("created_at", ""))
latest = updates[-1] if updates else {}
now_known[inc["id"]] = latest.get("id", "")
if known.get(inc["id"]) == latest.get("id", ""):
continue
fresh.append({
"name": inc.get("name"),
"status": inc.get("status"),
"impact": inc.get("impact"),
"started_at": inc.get("started_at") or inc.get("created_at"),
"link": inc.get("shortlink"),
"components": [c.get("name") for c in inc.get("components", [])],
"is_new": inc["id"] not in known,
"latest_update": (latest.get("body") or "")[:1500],
})
# Resolved incidents disappear from the feed, so the known list never grows unbounded.
print(f"{len(incidents)} unresolved incidents, {len(fresh)} new or updated")
print("::" + json.dumps({"outputs": {
"fresh_count": len(fresh),
"fresh": fresh,
"now_known": now_known,
}}) + "::")
- id: if_fresh
type: io.kestra.plugin.core.flow.If
description: Only call the LLM and Slack when there is something new to say.
condition: "{{ outputs.find_new_updates.vars.fresh_count > 0 }}"
then:
- id: assess_impact
type: io.kestra.plugin.ai.completion.ChatCompletion
description: Explain what the vendor incident likely means for your product, as
structured JSON.
provider:
type: io.kestra.plugin.ai.provider.GoogleGemini
apiKey: "{{ secret('GEMINI_API_KEY') }}"
modelName: "{{ inputs.model_name }}"
configuration:
temperature: 0.1
responseFormat:
type: JSON
jsonSchema:
type: object
properties:
severity_for_us:
type: string
enum:
- NONE
- LOW
- MEDIUM
- HIGH
impact:
type: string
action:
type: string
required:
- severity_for_us
- impact
- action
messages:
- type: SYSTEM
content: |
You are an on-call engineer. A vendor we depend on has posted incident updates.
Using only the incident text, the affected components and how we use the vendor,
rate the likely severity for our product (NONE if the affected components are not ones we use),
describe the likely customer-visible impact in at most 2 sentences, and give one concrete
action (for example pause deploys, enable a fallback, or post on our status page).
Do not invent details that are not in the incident text.
- type: USER
content: |
Our product: {{ inputs.product_context }}
Vendor: {{ fromJson(item.value).name }}
How we use it: {{ fromJson(item.value).usage }}
New or updated incidents:
{{ outputs.find_new_updates.vars.fresh | toJson }}
- id: alert_slack
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
description: Post the incident facts from the status page plus the AI impact
assessment.
url: "{{ secret('SLACK_WEBHOOK_URL') }}"
messageText: |
{{ (outputs.assess_impact.jsonOutput.severity_for_us == 'HIGH' or outputs.assess_impact.jsonOutput.severity_for_us == 'MEDIUM') ? ':rotating_light:' : ':information_source:' }} *{{ fromJson(item.value).name }} incident* (severity for us: {{ outputs.assess_impact.jsonOutput.severity_for_us }})
{% for inc in outputs.find_new_updates.vars.fresh %}- {{ inc.is_new ? 'NEW' : 'UPDATE' }}: <{{ inc.link }}|{{ inc.name }}> ({{ inc.status }}, vendor impact {{ inc.impact }}){% if inc.components | length > 0 %}, components: {{ inc.components | join(', ') }}{% endif %}
{% endfor %}
*Impact for us:* {{ outputs.assess_impact.jsonOutput.impact }}
*Suggested action:* {{ outputs.assess_impact.jsonOutput.action }}
- id: remember_updates
type: io.kestra.plugin.core.kv.Set
description: Remember the latest update of every unresolved incident. Runs after
the alert, so a failed alert is retried next time.
key: "status_watch_{{ fromJson(item.value).key }}"
kvType: JSON
overwrite: true
value: "{{ outputs.find_new_updates.vars.now_known | toJson }}"
errors:
- id: alert_failure
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
description: A status page that cannot be read must not look like a healthy vendor.
url: "{{ secret('SLACK_WEBHOOK_URL') }}"
messageText: ":warning: SaaS status watch failed in execution {{ execution.id }}
({{ flow.namespace }}.{{ flow.id }}). Open the failed loop iteration: a
status page URL may be wrong, or GEMINI_API_KEY may be invalid."
triggers:
- id: every_five_minutes
type: io.kestra.plugin.core.trigger.Schedule
description: Poll every five minutes. Disabled until the secrets are set.
cron: "*/5 * * * *"
disabled: true
- id: on_demand
type: io.kestra.plugin.core.trigger.Webhook
description: Run a check on demand, for example when customers report errors.
key: saas-status-watch-change-me