Notifications YAML Reference


This document is the reference to the YAML grammar used for describing notifications and specifying notification rules.

Notifications can be sent only when a pipeline is finished, either successfully or unsuccessfully. Additionally, you will need the sem command line tool in order to work with notifications.



The apiVersion property defines the version of the YAML grammar that will be used in the current YAML file. Different versions might have different features.

The list of values for apiVersion: v1alpha.


The kind property defines the purpose of the YAML file. For a YAML file that will be used for defining notifications, the value of the kind property should be Notification.

The list of values for kind: Notification.


The metadata property defines the metadata of a Notifications YAML file and supports the name, id, create_time and update_time.


The value of the name property in the metadata context, which is a string, defines the name of the notification. This is what will appear when you execute the sem get notifications command.


The value of the id property is automatically generated and assigned by Semaphore 2.0 and is unique among all notifications. It should not be edited.


The value of the create_time property is automatically generated by Semaphore 2.0 and is in the UNIX epoch format. It holds the time of creation of the notification.


The value of the update_time property is automatically generated by Semaphore 2.0 and is in the UNIX epoch format. It holds the last time the notification was altered.


The spec property holds the list of notification rules.


Each rules property holds the definition of a notification rule.

In order to define a notification you will need to have at least one rules item.

The rules property in more detail

In this section we are going to explain the properties that are used in a rules property.


The value of the name property, which is a string, in the metadata context defines the name of the notification rule.


The filter property holds the projects, branches and pipelines properties. The projects property is the only mandatory one.

The values of branches, projects and pipelines properties can contain regular expressions. Regex matches must be wrapped in forward slashes (/.*/). Specifying a branch/project/pipeline name without slashes (.*) would execute a direct equality match.

For a filter to be true, each one of its properties should be true. If a property such as branches has multiple values, at least one of these values should be true for the entire property to be true.

The filter property holds the logic of the notification rule.


The projects property is used for holding the list of the Semaphore 2.0 projects that interest us.

The projects property is mandatory.


The branches property holds a list of strings, which should be the GitHub branch names that interest us.

The branches property is optional.


The pipelines property is used for holding the list of the pipeline filenames that interest us.

The pipelines property is optional.


The notify property holds the slack property.


The slack property holds the endpoint and channels properties.


The endpoint property holds the URL of the Incoming WebHook that will be used. Incoming WebHooks offer a simple way for posting messages from external sources into Slack.

You can learn more about defining the value of the endpoint property by visiting Incoming WebHooks.

Please note that if a notification does not work as expected, you might want to begin the debugging process by verifying the Slack WebHook used.

Tip: you can use just a single Incoming WebHook from Slack for all your notifications as this Incoming WebHook has access to all the channels of a Slack Workspace.

The endpoint property is mandatory.


The channels property holds a list of strings. Each string item is the name of a Slack channel or the name of a Slack user. Slack channels begin with a # character and Slack users begin with a @ character.

A notification can send a message to multiple Slack channels and/or multiple users.

The channels property is optional. When the channels property is not defined, all notifications go to the default channel associated with the Incoming WebHook used.

An example

The following YAML code present an example of a notification as returned by the sem get notification [name] command:

$ sem get notifs docs
apiVersion: v1alpha
kind: Notification
  name: docs
  id: 2222f08c-93f9-459b-8825-ab8be49c9d19
  create_time: "1542024088"
  update_time: "1542280192"
  - name: Send notifications for docs project
      - API-docs
        - '#devops'
        - '@mtsoukalos'
  - name: On finished pipelines for S1, docs, or *-api projects
      - website
      - /.*-api$/
      - docs
      - /^feature-.*/
      - master
      - semaphore.yml
        - '#engineering'
status: {}

This notification has two rules, one named Send notifications for docs project and another named On finished pipelines for S1, docs, or *-api projects.

The first rule of the notification specifies a single project name that is called API-docs. All notifications will go to the #devops channel and to the mtsoukalos user using the specified Incoming WebHook of Slack. In this case the Slack channel associated with the specified Incoming WebHook will be ignored.

The second rule is more complex than the first one. The values of the projects property specify two exact project names named website and docs as well as a regular expression (/.*-api$/) that will be evaluated against all the project names of the current organization. For this filter to be true, at least one of the matches must be true.

Similarly, the branches property has two items. The first one is a regular expression that matches all branches that begin with the feature string and the second one is an exact match to the master branch.

After that, you specify in the pipelines filter that you are only interested in the main pipeline that always begins with the semaphore.yml file.

Once these three filters are evaluated to true, the rule will send a notification to the #engineering channel. Once again, the Slack channel associated with the specified Incoming WebHook will be ignored.

Please note that the status property at the end is not currently being used.

You can find out how to create new notifications by visiting the Slack Notification and the sem command line tool Reference pages of the Semaphore 2.0 documentation.

See Also

Still need help? Contact Us Contact Us