Version: v1.1

Webhook Notification

If we want to be notified before or after deploying an application, KubeVela provides integration with notification webhooks, allowing users to send notifications to DingTalk or Slack.

In this guide, you will learn how to send notifications via webhook-notification in workflow.

Parameters

ParameterTypeDescription
slackObjectOptional, please fulfill its url and message if you want to send Slack messages
slack.urlStringRequired, the webhook address of Slack
slack.messageObjectRequired, the Slack messages you want to send, please follow Slack messaging
dingdingObjectOptional, please fulfill its url and message if you want to send DingTalk messages
dingding.urlStringRequired, the webhook address of DingTalk
dingding.messageObjectRequired, the DingTalk messages you want to send, please follow DingTalk messaging

How to use

Apply the following Application with workflow step type of webhook-notification:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: dingtalk-message
  22. # specify the workflow step type
  23. type: webhook-notification
  24. properties:
  25. dingding:
  26. # the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
  27. url: <your dingding url>
  28. # specify the message details
  29. message:
  30. msgtype: text
  31. text:
  32. content: Workflow starting...
  33. - name: application
  34. type: apply-component
  35. properties:
  36. component: express-server
  37. outputs:
  38. - from: app-status
  39. exportKey: output.status.conditions[0].message + "工作流运行完成"
  40. - name: slack-message
  41. type: webhook-notification
  42. inputs:
  43. - name: app-status
  44. parameterKey: properties.slack.message.text
  45. properties:
  46. slack:
  47. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  48. url: <your slack url>
  49. # specify the message details, will be filled by the input value
  50. # message:
  51. # text: condition message + Workflow ended.

Expected outcome

we can see that before and after the deployment of the application, the messages can be seen in the corresponding group chat.

With webhook-notification, we can integrate with webhook notifier easily.