Context
The Context in Keep workflows allows you to reference and utilize data dynamically across different parts of your workflow. Context variables give you access to runtime data such as alert details, results from previous steps or actions, and constants defined in your workflow.
This capability makes workflows flexible, reusable, and able to handle complex scenarios dynamically.
Accessing Context
Context variables can be accessed using curly braces ({{ }}
). You can use these variables directly in triggers, steps, and actions. The context includes:
- Alert Data: Access data from the alert triggering the workflow.
- Incident Data: If the workflow is incident-based, you can access the incident’s attributes.
- Steps and Actions Results: Retrieve data produced by previous steps or actions using their unique IDs.
Alert Data
You can access attributes of the alert anywhere in the workflow:
Incident Data
For incident workflows, access incident-related context:
Steps Results
Access results from previous steps:
Action Results
Retrieve data from completed actions:
Constants
Define reusable values in the workflow and access them:
Using Context in Loops
When iterating over data in a foreach
loop, the context provides foreach.value
for the current iteration.
For example:
Examples of Context Usage
Dynamic Action Execution
Using context to trigger actions conditionally:
Enriching Alerts
You can use results from a step to enrich an alert