User Notification
About 390 wordsAbout 1 min
Overview
Cloud Native Build supports users to subscribe to system events and push notification messages to a 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 are as follows:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| URL | String | Y | Callback URL. Cloud Native Build will send notification messages here. |
| Type | String | Y | Select User Notification |
| Trigger | String | Y | Subscribed event types, multiple selections supported |
| Token | String | N | Authorization token for the callback URL, optional |
Event Types
Cloud Native Build supports the following event types (not limited to):
- 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-8X-CNB-Event:System Hook, identifies the notification message eventX-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 | List of member IDs to receive the message (separated by |, up to 1000) |
| msgtype | String | Y | Message type, fixed as: text |
| content | String | Y | Message content, up to 2048 bytes |
Notification Message Example
Taking Pull Request review as an example, when a reviewer approves the PR, the following notification is sent:
admin1 approved PR #1
feat: init
https://cnbprod.alpha.qq.com/test/test-repo/-/pulls/1Request body content:
{
"touser": "123",
"msgtype": "text",
"text": {
"content": "admin1 approved PR #1\n\nfeat: init\ncnbprod.alpha.qq.com/test/test-repo/-/pulls/1"
}
}