6.10 Notification, Notifier
Notification and Notifier definitions and definition examples are shown below. For details of Notification and Notifier, see “Designing notifications”.
The YAML definitions of Notification are as follows.
(Table) Notification definitions
| Label | Default value | Required* | Description | ||
|---|---|---|---|---|---|
| apiVersion: | Yes | API version Specify 1.0. |
|||
| kind: | Yes | Specify "notification". | |||
| type: | No | Specify "resource". It indicates a new definition to be added to the operational function of Ops I. |
|||
| name: | Yes | Internal name of the Notification definition. "name" should follow the conventions shown below:
|
|||
| label: | Yes | Display name of the operational function to be written in the YAML file | |||
| includes: | No | List the related YAML files for use in this YAML file.
Tips
|
|||
| - kind: | Yes | Type of YAML file to be loaded | |||
| name: | Yes | Internal name of YAML file to be loaded | |||
| description: | No | Detailed description of this YAML file. This can be written using the template function. | |||
| event: | Yes | Event conditions for notification | |||
| resource: | Yes | There are two roles as follows:
|
|||
| type: | Yes | Event types Configure the types of events for which notifications are to be issued.
"onDemand" can be specified when the event resource is a "workflow". For specification examples, see "Examples of workflow definitions including notifications". |
|||
| conditions: | No | Describe the conditions for notification. Do not specify this if the event type is "onDemand". |
|||
| - | No | If there are multiple conditions, they will be judged using an "or" condition. Conditions for lower levels are judged using an "and" condition. | |||
| - resource: | Yes | Specify the object fields used to evaluate conditions. You can specify object fields that can be referenced from the resource specified in "event:.resource:". In addition, the object field uses the notation ".Context" for the current value of the data being judged, and ".PrevContext" for the value before the change. If the event type (type) is "update", the current value can be obtained with ".Context" and the value before the change can be obtained with ".PrevContext". If the event type (type) is "delete", the value before deletion can be obtained with ".PrevContext", and ".Context" cannot be used. If the event type ("type") is "time", ".Context" can be used, but ".PrevContext" cannot be used. Example: "{{ .GetValue ".Context.workflow.name" }}" "{{ .GetValue ".PrevContext.status" }}" For details about the object fields that can be used within the Notification definition, see "(Table) Object fields that can be used in Notification". |
|||
| <operator>: | Yes | Specify the operator and operand of the condition with <key>: <value>. <key> Specify the operator. The following types are available.
Specify the operand. Example: "eq: WorkflowNameAAA" |
|||
| notifications: | Yes | List of notification objects to be sent | |||
| - message: | Yes | Notification object message to be sent | |||
| title: | Yes | Message title It is also possible to embed fields starting from the object specified in the event condition ("event" part) of the notification. Note that only the current value (.Context) can be used. The value before the change (.PrevContext) cannot be used. Example: "There is an request for {{ .GetValue ".Context.activity" }}." If the event type is "onDemand", you can retrieve values by specifying the parameters defined in the "params" section of "oi.notify" in the Workflow YAML file using the following syntax: Example: "{{ .OINotify.params.parameter }}" |
|||
| body: | Yes | Body of the message. It is also possible to embed fields starting from the object specified in the event condition ("event" part) of the notification. Example: "There is an request for {{ .GetValue ".Context.workflow.name" }}." If the event type is "onDemand", you can retrieve the values of parameters specified in the "params" section of "oi.notify" in the Workflow YAML file using the following syntax: Example: "{{ .OINotify.params.parameter }}" |
|||
| referTo: | No | Message reference. It is also possible to embed fields starting from the object specified in the event condition ("event" part) of the notification. When listing the URL for Ops I, check in advance that the user set as the recipient of the notification has access rights for the URL listed. Example: https://{{ .System.domain }}/sys_request/workflow_list/workflow_detail/{{ .GetValue ".Context.workflow" }} If the event type is "onDemand", you can retrieve the value of a parameter specified in the "params" section of "oi.notify" in the Workflow YAML file using the following syntax: Example: "{{ .OINotify.params.parameter }}" |
|||
| severity: | Information | No | Notification severity The following values can be used.
| ||
| destinations: | Yes | List of message recipients The contents of a "message" object can be sent to multiple recipients. |
|||
| - type: | Yes | Recipient type Select from the following
| |||
| value: | Yes | Recipient value It is also possible to embed fields starting from the object specified in the event condition ("event" part) of the notification. Note that only the current value (.Context) can be used. The value before the change (.PrevContext) cannot be used. Example: "{{ .GetValue ".Context.assignedGroup"}}" If the event type is "onDemand", you can retrieve the value of a parameter specified in the "params" section of "oi.notify" in the Workflow YAML file using the following syntax: Example: "{{ .OINotify.params.parameter }}" |
|||
| notifiers: | No | Specify the means of notifying the recipient. Specify the "name" of the Notifier in an array. For an example of specifying an array, see "<Definition example> Notifier (Work item deletion notification)". TipsRegardless of whether this parameter is specified, notifications via the Ops I GUI are executed. |
|||
The object fields that can be used within the Notification definition are as follows.
(Table) Object fields that can be used in Notification
| Object | Field | Data type*1 | Output value | Notes | Conditions for retrieving values |
|---|---|---|---|---|---|
| workflow | createdOn*3 | Date*4 | Workflow creation date and time | - | Always available |
| workflow | updatedOn | Date*4 | Workflow update date and time | - | Always available However, immediately after the workflow starts, the value is set to 1970/1/1 00:00:00. The updated value is retrieved when the workflow status changes or the workflow title is modified. |
| workflow | createdBy*3 | str | User name of the workflow creator | user object*2 To retrieve the user ID: "{{ .GetValue ".Context.createdBy"}}" To retrieve the user name: "{{ .GetValue ".Context.createdBy.name"}}" |
Always available |
| workflow | id*3 | uuid | Workflow ID | - | Always available |
| workflow | name | str | Workflow name | The value of the "name" label in the Workflow YAML definition | Always available |
| workflow | schedule*3 | uuid | ID of the schedule directly associated with the workflow | schedule object*2 | Always available |
| workflow | Any task name | uuid | ID of the schedule with the specified task name | schedule object*2 You can specify any schedule that belongs to the workflow. |
Always available |
| workflow | title | str | Workflow title | - | Always available |
| workflow | status*3 | str | Workflow status | - | Always available |
| workflow | customer*3 | str | Customer ID | customer object*2 To retrieve the customer ID: "{{ .GetValue ".Context.customer"}}" To retrieve the customer name: "{{ .GetValue ".Context.customer.name"}}" |
If the object is a workflow initiated by the customer user |
| workflow | parentContext | uuid | ID of the parent workflow | workflow object*2 | In the case of a subflow |
| workflow | rootContext | uuid | ID of the root workflow | workflow object*2 | Always available |
| workflow | label | str | Label | The value of the "label" label in the Workflow YAML definition. It is output in the language specified in the hearing sheet. |
Always available |
| workflow | currentSchedule | uuid | ID of the currently running schedule (including those in the "Pending" state) | schedule object*2 To reference the workflow assignee: "{{workflow.currentSchedule.assignedTo.name}}" To reference the workflow assigned group: "{{workflow.currentSchedule.assignedGroup.name}}" |
If a running schedule exists |
| workflow | schedules.Any task name | uuid | ID of the schedule with the specified task name | schedule object*2 You can specify any schedule that belongs to the workflow. |
Always available |
| workflow | description | str | Description | - | If set by the user*5 |
| workflow | category | str | Category | - | If set by the user*5 |
| workflow | dueDate | Date*4 | Due date | - | If set by the user*5 |
| workflow | note1 | str | Remarks | - | If set by the user*5 |
| workflow | note2 | str | Remarks 2 | - | If set by the user*5 |
| workflow | note3 | str | Remarks 3 | - | If set by the user*5 |
| schedule | id*3 | uuid | Schedule ID | - | Always available |
| schedule | workflow | Date*4 | Workflow ID tied to a schedule | workflow object*2 | If the object is a schedule generated by a workflow initiation |
| schedule | activity*3 | str | The name of the activity linked to the schedule | - | Always available |
| schedule | parent*3 | uuid | ID of the parent schedule | schedule object*2 | If the object is a schedule for a workflow activity |
| schedule | assignedTo*3 | uuid | ID of the assignee user | user object*2 This field must be specified when notifying the agent for each step in the workflow or the agent for a schedule that is not linked to a calendar. |
If the object is a schedule that meets any of the following conditions:
|
| schedule | assignedGroup*3 | uuid | ID of the assignee group | group object*2 | If the object is a schedule that meets any of the following conditions:
|
| schedule | assignedUsers*3 | uuid list | A list of IDs of assigned users | user object*2 This field must be specified when using the agent for the work item (multiple people can be specified) to send notifications. If multiple items are specified, use a comma (,) to separate them. When using in/notIn for the operator, the following evaluation is performed.
|
If the object is a schedule for a work item for which an assignee has been assigned |
| schedule | status*3 | str | Schedule status | For the value, see "Detailed API reference information > Standard API functions > Schemas > dtos.ScheduleDTO > status" in "JP1 Cloud Service/Operations Integration API Reference". | Always available |
| schedule | workflowStatus*3 | str | Status of the workflow activity tied to a schedule | For the value, see "Detailed API reference information > Standard API functions > Schemas > dtos.ScheduleDTO > workflowStatus" in "JP1 Cloud Service/Operations Integration API Reference". | If the object is a schedule for a workflow activity |
| schedule | plannedStart*3 | Date*4 | Planned start date and time of the schedule | - | If the object is a schedule with a scheduled start date and time |
| schedule | plannedEnd*3 | Date*4 | Planned end date and time of the schedule | - | If the object is a schedule with a scheduled end date and time |
| schedule | calendar*3 | uuid | ID of the calendar to which the work item linked to the schedule belongs | calendar object*2 | If the object is a schedule for a work item |
| schedule | title*3 | str | Schedule title | - | If the object is a schedule that meets any of the following conditions:
|
| schedule | scheduleType*3 | str | Schedule type | The following values are set.
|
If the object is a schedule for a work item |
| schedule | workitem*3 | uuid | ID of the related work item | workitem object*2 | If the object is a schedule for a work item |
| schedule | canceled*3 | bool | Schedule deletion and restoration | - | If the object is a schedule for a work item |
| schedule | changedFromWorkItemDefinition*3 | bool | Flag indicating changes since the work item was created | - | If the object is a schedule for a work item |
| user | id | uuid | User ID | - | Always available |
| user | name | str | Username | - | Always available |
| user | str | User e-mail address | - | Always available | |
| user | number | str | Phone number | - | If the object is a user with a phone number set |
| user | displayName | str | User display name | The order of first and last names varies by language (Japanese/English). It follows the language specified in the hearing sheet. | Always available |
| group | id | uuid | Group ID | - | Always available |
| group | name | str | Group name | - | Always available |
| group | str | Group e-mail address | - | If the object is a group with an email address set | |
| calendar | id | uuid | Calendar ID | - | Always available |
| calendar | name | str | Calendar name | - | Always available |
| calendar | assignedGroups | uuid list | A list of IDs of assigned "group" | group object*2 If multiple items are specified, use a comma (,) to separate them. When using in/notIn for the operator, the following evaluation is performed.
|
Always available |
| workitem | id*3 | uuid | Work item ID | - | Always available |
| workitem | calendar*3 | uuid | Calendar ID | calendar object*2 | Always available |
| workitem | name*3 | str | Work item name | - | Always available |
| workitem | createdOn*3 | Date*4 | Work item creation date and time | - | Always available |
| workitem | createdBy*3 | uuid | ID of the work item creator | user object*2 | Always available |
| workitem | updatedOn | Date*4 | Work item update date and time | - | If the object's work items have been updated at least once |
| workitem | updatedBy | uuid | ID of the work item updater | user object*2 | If the object's work items have been updated at least once |
| workitem | workflowExecUser*3 | uuid | Workflow executor | user object*2 | If the object is a work item with automatic workflow execution configured for it |
| workitem | assignedUsers*3 | uuid list | A list of IDs of assigned users | user object*2 This field must be specified when using the agent for the work item (multiple people can be specified) to send notifications. If multiple items are specified, use a comma (,) to separate them. When using in/notIn for the operator, the following evaluation is performed.
|
If the object is a work item with an assignee assigned |
| workitem | assignedGroup*3 | uuid | ID of the assignee group | group object*2 | If the object is a work item with an assigned group |
| workitem | plannedStart*3 | str | Planned start time of the work item | Format: HH:MM:SS | Always available |
| workitem | duration*3 | int | Planned duration of work item (minutes) | - | Always available |
| workitem | scheduleType*3 | str | Schedule type | The following values are set.
|
Always available |
| workitem | recurrenceNum*3 | int | Number of work item repetitions | - |
|
| workitem | startDate*4 | str | Start date of the work item | Format: YYYY-MM-DD | If the object is a work item with a start date specified |
| workitem | endDate*3 | str | End date of the work item | Format: YYYY-MM-DD | If the object is a recurring work item with an end date specified |
| customer | id | str | Customer ID | - | Always available |
| customer | name | str | Customer name | - | Always available |
Example: .Context.schedule.assignedTo
Also, when "event.type" is "update" or "delete", you can retrieve the values before the change by using ".PrevContext".
| Item | Format | Example |
|---|---|---|
| condition section | YYYY-MM-DDTHH:mm:ss±hh:mm | 2025-01-02T03:04:05+09:00 |
| message section | YYYY-MM-DD HH:mm:ss time zone | 2025-01-02 03:04:05 JST |
The YAML definitions of Notifier are as follows.
| Label | Default value | Required* | Description | |||
|---|---|---|---|---|---|---|
| apiVersion: | Yes | API version Specify 1.0. |
||||
| kind: | Yes | Specify "notifier" | ||||
| type: | No | Specify "resource". It indicates a new definition to be added to the operational function of Ops I. |
||||
| name: | Yes | Internal name of the Notifier definition. "name" should follow the conventions shown below:
|
||||
| label: | Yes | Display name of the operational function to be written in the YAML file | ||||
| includes: | No | List the related YAML files for use in this YAML file.
Tips
|
||||
| - kind: | Yes | Type of YAML file to be loaded | ||||
| name: | Yes | Internal name of YAML file to be loaded | ||||
| description: | No | Detailed description of this YAML file | ||||
| protocol: | Yes | Protocol used for the notification method The following protocols can be used.
|
||||
| property: | Yes | smtp properties | ||||
| credential: | Yes | Authentication information for the SMTP server. Fixed "default" |
||||
| url: | Yes | SMTP server address Fixed "email-smtp.ap-northeast-1.amazonaws.com" |
||||
| port: | Yes | SMTP server port. Fixed "587" |
||||
| to: | Yes | Specify the recipient email address. The notification email is sent with the specified email address in the Bcc header. To send to multiple recipients, separate email addresses with commas (,). By embedding fields from objects included in the notification, you can include the content displayed on the GUI in the email notification as well. To specify this, concatenate the object and field you want to embed in ".Context". See "(Table) Object fields that can be used in Notifier" for object fields that can be used in Notifier. Example: {{ .Context.receiver.email }} |
||||
| from: | No | The SMTP sender address. Fixed "noreply@ops-integration.com" |
||||
| subject: | No | The e-mail title. By embedding fields from objects contained in a notification, you can include the content displayed on the GUI in the email notification as well. To specify this, concatenate the object and field you want to embed in ".Context". See "(Table) Object fields that can be used in Notifier" for object fields that can be used in Notifier. Example: {{ .Context.message.title }} |
||||
| message: | No | The e-mail body. By embedding fields from objects contained in a notification, you can include the content displayed on the GUI in the email notification as well. To specify this, concatenate the object and field you want to embed in ".Context". See "(Table) Object fields that can be used in Notifier" for object fields that can be used in Notifier. Example: {{ .Context.message.body }} |
||||
| conditions: | No | If the conditions of this definition are met, notifications will be sent using this Notifier. | ||||
| - | No | If there are multiple conditions, they will be judged using an "or" condition. Conditions for lower levels are judged using an "and" condition. | ||||
| - resource: | Yes | Prerequisites You can also embed fields from objects contained in a notification. To specify this, concatenate the object and field you want to embed in ".Context". See "(Table) Object fields that can be used in Notifier" for object fields that can be used in Notifier. Example: {{ .Context.receiver.email }} |
||||
| <operator>: | Yes | Specify the operator and operand of the condition with <key>: <value>. <key> Specify the operator. The following types are available.
Specify the operand. Example: regex: ^∗@hitachi.com$ |
||||
The object fields that can be used within the Notifier definition are as follows.
(Table) Object fields that can be used in Notifier
| Object | Field | Description |
|---|---|---|
| message | title | Message title |
| message | severity | Message severity |
| message | body | Message content |
| message | referTo | Message reference |
| receiver | Destination e-mail address |
<Definition example> Notification
apiVersion: 1.0
kind: notification
## Meta data
type: resource
name: lend_reject_notification
label: lend_reject_notification
description: A YAML definition that sends a rejection notice to the requester.
## Notification contents
event:
resource: schedule
type: update
conditions:
-
- resource: '{{ .GetValue ".Context.activity" }}'
eq: create_vm_wf_04
- resource: '{{ .GetValue ".Context.workflowStatus" }}'
eq: pending
- resource: '{{ .GetValue ".PrevContext.workflowStatus" }}'
eq: succeeded
notifications:
- message:
title: VM lending rejection notice
body: |
A notice of rejection for the VM lending has been received. Please check the information provided and take the appropriate action.
Date and time of application:{{ .GetValue ".Context.createdOn" }}
Requester:{{ .GetValue ".Context.createdBy" }}
referTo: https://{{ .System.domain }}/sys_request/workflow_list/workflow_detail/{{ .GetValue ".Context.workflow" }}
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".Context.createdBy" }}'
apiVersion: 1.0
kind: notifier
## Meta data
type: resource
name: email
label: Normal case
description: Normal case
protocol: smtp
property:
credential: default
url: email-smtp.ap-northeast-1.amazonaws.com
port: 587
to: '{{ .Context.receiver.email }}'
from: noreply@ops-integration.com
subject: '{{ .Context.message.title }}'
message: |
{{ .Context.message.body }}
<Definition example> Notifier (Work item deletion notification)
apiVersion: 1.0
kind: notification
## Meta data
type: resource
name: workitem_notification
label: workitem_notification
description: |
Work item deletion notification
## Notification contents
event:
resource: workitem
type: delete
notifications:
- message:
title: '[{{ .GetValue ".PrevContext.name" }}] has been deleted.'
body: |
work item "{{ .GetValue ".PrevContext.name" }}" has been deleted.
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".PrevContext.assignedUsers" }}'
notifiers:
- email
Tips