User Notification
About 376 wordsAbout 1 min
Overview
Cloud Native Build supports users to subscribe to system events and send messages to the configured callback URL.
Workflow
Notification Configuration
After logging into the admin management platform, click Admin Console -> System Hook Configuration -> Create System Hook to enter the configuration page. 
The configuration parameters required for user notification are as follows:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| URL | String | Y | Notification callback URL. Cloud Native Build will send notification messages to this address. |
| Type | String | Y | Select User Notification |
| Trigger | String | Y | Subscribed event types, multiple selections allowed |
| Token | String | N | Used for token authorization verification of the callback URL, optional |
Event Types
Cloud Native Build supports the following or more event types:
- pull request
- New comment
- New assignee
- New reviewer
- Status change
- New review
- issue
- New comment
- New assignee
- Status change
- Repository
- Archive
- Delete
- Transfer
- Member role change
- Organization
- Transfer
- Member role change
- User
- @user
Notification Message Structure
Notification Header
Content-Type: "application/json;charset=utf-8"- `X-CNB-Event": "System Hook", identifies the notification message event
X-CNB-Token: If an authorization token is configured (seeNotification Configuration), this field will be included
Notification Body
{
"touser": "UserID1|UserID2|UserID3",
"msgtype": "text",
"text": {
"content": "There is a new PR to be processed"
}
}Parameter descriptions:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| touser | String | Y | Specifies the members to receive the message, a list of member IDs (multiple recipients separated by |, up to 1000). |
| msgtype | String | Y | Message type, fixed as: text |
| content | String | Y | Message content, maximum 2048 bytes |
Notification Message Example
Taking pull request new review as an example, when the reviewer approves the PR, the following notification message will be sent:
admin1 approved PR #1
feat: init
https://cnb.share.ralphlauren.cn/test/test-repo/-/pulls/1Request body content:
{
"touser": "123",
"msgtype": "text",
"text": {
"content": "admin1 approved PR #1\n\nfeat: init\ncnb.share.ralphlauren.cn/test/test-repo/-/pulls/1"
}
}