Create an alert, fetch it to confirm, then execute it on demand.
Chains createAlert, fetchAlert, and executeAlert so an alert is provisioned with a condition and action, verified, and run once on demand, all scoped to the same database and schema.
arazzo: 1.0.1
info:
title: Snowflake Create and Execute an Alert
summary: Create an alert with a condition and action, describe it, then execute it on demand.
description: >-
Alerting flow for Snowflake. The workflow creates an alert that runs a
condition query on a schedule and performs an action when the condition is
met, describes the alert to confirm creation, and then executes the alert
immediately rather than waiting for its schedule. Each step inlines its
Authorization bearer token and the X-Snowflake-Authorization-Token-Type
header, its create-mode query parameter, and its JSON request body where
applicable so the chain can be read and executed without opening the
underlying OpenAPI description.
version: 1.0.0
sourceDescriptions:
- name: alertApi
url: ../openapi/snowflake-alert-api-openapi.yml
type: openapi
workflows:
- workflowId: create-and-execute-alert
summary: Create an alert, fetch it to confirm, then execute it on demand.
description: >-
Chains createAlert, fetchAlert, and executeAlert so an alert is provisioned
with a condition and action, verified, and run once on demand, all scoped to
the same database and schema.
inputs:
type: object
required:
- authToken
- databaseName
- schemaName
- alertName
- warehouse
- condition
- action
properties:
authToken:
type: string
description: Bearer token (KEYPAIR_JWT, OAUTH, or programmatic access token).
tokenType:
type: string
description: Value for the X-Snowflake-Authorization-Token-Type header.
default: OAUTH
databaseName:
type: string
description: Database that holds the schema and alert.
schemaName:
type: string
description: Schema that holds the alert.
alertName:
type: string
description: Name of the alert to create.
warehouse:
type: string
description: Warehouse used to evaluate the alert condition and action.
condition:
type: string
description: The SQL condition that triggers the alert.
action:
type: string
description: The SQL action performed when the condition is met.
schedule:
type: object
description: The schedule object controlling how often the alert is evaluated.
comment:
type: string
description: Optional comment applied to the alert.
steps:
- stepId: createAlert
description: Create the alert with its condition, action, warehouse, and schedule.
operationId: createAlert
parameters:
- name: database
in: path
value: $inputs.databaseName
- name: schema
in: path
value: $inputs.schemaName
- name: createMode
in: query
value: errorIfExists
- name: Authorization
in: header
value: Bearer $inputs.authToken
- name: X-Snowflake-Authorization-Token-Type
in: header
value: $inputs.tokenType
requestBody:
contentType: application/json
payload:
name: $inputs.alertName
warehouse: $inputs.warehouse
condition: $inputs.condition
action: $inputs.action
schedule: $inputs.schedule
comment: $inputs.comment
successCriteria:
- condition: $statusCode == 200
outputs:
status: $response.body#/status
- stepId: fetchAlert
description: Describe the alert to confirm it was created.
operationId: fetchAlert
parameters:
- name: database
in: path
value: $inputs.databaseName
- name: schema
in: path
value: $inputs.schemaName
- name: name
in: path
value: $inputs.alertName
- name: Authorization
in: header
value: Bearer $inputs.authToken
- name: X-Snowflake-Authorization-Token-Type
in: header
value: $inputs.tokenType
successCriteria:
- condition: $statusCode == 200
outputs:
alertName: $response.body#/name
state: $response.body#/state
- stepId: executeAlert
description: Execute the alert immediately rather than waiting for its schedule.
operationId: executeAlert
parameters:
- name: database
in: path
value: $inputs.databaseName
- name: schema
in: path
value: $inputs.schemaName
- name: name
in: path
value: $inputs.alertName
- name: Authorization
in: header
value: Bearer $inputs.authToken
- name: X-Snowflake-Authorization-Token-Type
in: header
value: $inputs.tokenType
successCriteria:
- condition: $statusCode == 200
outputs:
status: $response.body#/status
outputs:
createStatus: $steps.createAlert.outputs.status
alertState: $steps.fetchAlert.outputs.state
executeStatus: $steps.executeAlert.outputs.status
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.