Notification

The notification workflow step sends a notification to a third party system once the step is reached. The step supports sending notifications to:

Sending messages to Slack

The following snippet contains an example to send a message to Slack using the notification workflow step.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: slack-app
spec:
  components:
  - name: slack-app-comp
    type: worker
    properties:
        image: my-app-image:v1.0.0
        cmd: ["server", "run"]
        cpu: "0.25"
        memory: "200Mi"
  workflow:
    steps:
      - name: slack-message
        type: notification
        properties:
          slack: # set to slack  
            # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
            url:
              # url can either specify in value or secretRef
              value: url # (Optional) slack url
              secretRef: # (Optional) slack url in a secret
                name: secret-name # (Required) secret name
                key: url # (Required) secret key
            message: # (Required) message to send
              text: Hello!! # (Optional) text

Sending messages to Lark

The following snippet contains an example to send a message to Lark using the notification workflow step. This option is experimental.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: lark-app
spec:
  components:
  - name: lark-app-comp
    type: worker
    properties:
        image: my-app-image:v1.0.0
        cmd: ["server", "run"]
        cpu: "0.25"
        memory: "200Mi"
  workflow:
    steps:
      - name: lark-message
        type: notification
        properties:
          lark: # set to lark
            # webhook address
            url:
              # url can either specify in value or secretRef
              value: url # (Optional) url
              secretRef: # (Optional) url in a secret
                name: secret-name # (Required) secret name
                key: url # (Required) secret key
            message: # (Required) message to send
              msg_type: text # (Required) type text|post|image|interactive|share_chat|share_user|audio|media|file|sticker
              content: content # (Required) json encode string

Sending messages to DingTalk

The following snippet contains an example to send a message to DingTalk using the notification workflow step. This option is experimental.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: ding-app
spec:
  components:
  - name: ding-app-comp
    type: worker
    properties:
        image: my-app-image:v1.0.0
        cmd: ["server", "run"]
        cpu: "0.25"
        memory: "200Mi"
  workflow:
    steps:
      - name: ding-message
        type: notification
        properties:
          dingding: # (Optional) ding notification 
            # the url
            url:
              # url can either specify in value or secretRef
              value: url # (Optional) url
              secretRef: # (Optional) url in a secret
                name: secret-name # (Required) secret name
                key: url # (Required) secret key
            message: # (Required) message to send
              text: Hello!! # (Optional) text 

Sending messages by Email

The following snippet contains an example to send a message by Email using the notification workflow step. This option is experimental.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: email-app
spec:
  components:
  - name: email-app-comp
    type: worker
    properties:
        image: my-app-image:v1.0.0
        cmd: ["server", "run"]
        cpu: "0.25"
        memory: "200Mi"
  workflow:
    steps:
      - name: email-message
        type: notification
        properties:
          email: # Set to email
            from: # (Required)
              address: from@mail.com # (Required) email
              alias: alias # (Optional) email alias
              # password can either specify in value or secretRef
              password: # (Required) 
                value: password # (Optional)
                secretRef: # (Optional)
                  name: secret-name # (Optional) secret name
                  key: string # (Optional) secret key
              host: host # (Required) email host
              port: 587 # (Required) email port. By default 587
            to:
              - to@mail.com # (Required) a list of emails to send the notification
            content: # (Required)
              subject: subject # (Required) email subject
              boty: Hello # (Required) context body