A Custom Action’s rule and response fields support liquid templating. When templates are evaluated, they receive a context object. This allows the action to behave dynamically based on the information in the context.
Context fields are accessed using Liquid's double handle bar notation: {{ identifier }}. When evaluated this would be replaced by the matching value in the context.
The action context contains the following properties:
Service
Actions are invoked on a specific service. These properties all refer to that service.
Description | |
---|---|
service.framework | The primary software development framework that the service uses. |
service.href | A link to the HTML page for the service. |
service.id | The unique identifier for the service. |
service.language | The primary programming language that the service is written in. |
service.lifecycle_index | The lifecycle stage of the service. |
service.name | The display name of the service. |
service.product | A product is an application that your end user interacts with. Multiple services can work together to power a single product. |
service.service_repositories | A list of repositories that are linked to the service. |
service.slug | The URL friendly name of the service. |
service.tier_index | The software tier that the service belongs to. |
User
Actions are invoked by an individual user. These properties all refer to that user.
Description | |
---|---|
user.api_token_count | The number of api tokens owned by this user. |
user.deactivated | True if this user is deactivated and cannot be used. |
user.deactivated_at | The time that the user was deactivated. |
user.email | The user's email. |
user.gravatar_url | The url to the user's gravatar image. |
user.has_provider | Whether this user is managed externally. |
user.href | A link to the HTML page for the user. |
user.id | The unique identifier for the user. |
user.name | The user's full name. |
user.pending | Whether the user accepted their invitation to OpsLevel or not. |
user.provisioned_by |
How the user was provisioned. Possible values:
|
user.role | The user's assigned role. |
Manual Inputs
Manual inputs are the fields presented to a user when they invoke an Action. They are also injected into the context and can be referenced using the value defined in the identifier property.
Manual inputs are available as sub-properties of the manualInputs property.
Given this defined input:
---
version: 1
inputs:
- identifier: bucketName
# ...
The value of this input would be available to the Action’s context with {{ manualInputs.bucketName }}.
Action Owner
The action owner is the Team responsible for maintaining the action being invoked. This field may be blank if the Team specified as the owner has been deleted from OpsLevel.
Description | |
---|---|
action_owner.contacts |
A list of details for contacting the action owner.
See Contact for more details. |
action_owner.href | A link to the HTML page for the action owner. |
action_owner.id | The unique identifier for the action owner. |
action_owner.manager |
The user who manages the action owner.
See User for more details. |
action_owner.name | The display name of the action owner. |
action_owner.slug | A human-friendly, unique identifier. |
Contact
Contacts are the communication channels used to get in touch with the action owner.
Description | |
---|---|
contact.address |
The contact address. Examples:
|
contact.contact_method |
The method of contact. Possible values:
|
contact.display_name | The name shown in the UI for the contact. |
contact.display_type |
The type shown in the UI for the contact. Possible values:
|
contact.id | The unique identifier for the contact. |
contact.target_href | The fully qualified URI for the contact. |
Response
The Response Details property injects an additional object into the Action’s context. These properties all refer to the response received from the webhook URL when invoking the action.
The response headers and body will be coerced into JSON if possible and can be referenced in the Liquid template as {{ response.headers.<property> }}.
Description | |
---|---|
response.status | The HTTP status code. |
response.headers | The HTTP headers. |
response.body | The response body. |
Filters
In addition to Liquid’s standard filters, we also support:
contacts_by_display_name
Find contacts by their display name
- Input: {{ team | contacts_by_display_name: 'pagerduty' }}
- Output: [contact_1, contact_2]
tag_value
Returns the value of the first matching tag.
- Input: {{ service | tag_value: "version" }}
- Output: "3.2.1"
tag_values
Returns the array of matching tag values.
- Input: {{ service | tag_values: "ip" }}
- Output: ["1.1.1.1", "2.2.2.2"]
This can be combined with the standard filters to extract specific values:
- Input: {{ service | tag_values: "ip" | last }}
- Output: "1.1.1.1"