Setting Generic Webhook Subscriptions
Scenario
CodeArts allows you to customize notifications to send user operation events to a third-party platform through HTTP.
The following table lists the supported services and event types.
|
Category |
Event Type |
|---|---|
|
Raw requirement |
Create/Submit |
|
Edit |
|
|
Delete |
|
|
Change |
|
|
Update status |
|
|
Ticket reminder added |
|
|
Comment |
|
|
System feature (SF) |
Create |
|
Edit |
|
|
Delete |
|
|
Change |
|
|
Baseline/Unbaseline |
|
|
Update status |
|
|
Ticket reminder added |
|
|
Comment |
|
|
R&D requirement (IR/SR/AR) |
Create |
|
Edit |
|
|
Delete |
|
|
Change |
|
|
Baseline/Unbaseline |
|
|
Move |
|
|
Comment |
|
|
Ticket reminder added |
|
|
Update status |
|
|
Task |
Create |
|
Edit |
|
|
Delete |
|
|
Comment |
|
|
Ticket reminder added |
|
|
Update status |
|
|
Bug |
Create/Submit |
|
Edit |
|
|
Delete |
|
|
Move |
|
|
Update status |
|
|
Ticket reminder added |
|
|
Comment |
|
|
Review |
Submit |
|
Transfer to others |
|
|
Cancel/Reject |
|
|
Change object reviewed |
|
|
Change object decision-making completed |
|
|
Review or decision-making completed |
|
|
Delete |
|
|
Comment |
|
Category |
Event Type |
|---|---|
|
Repository |
Capacity warning |
|
Repo deleted |
|
|
MR |
MR opened |
|
MR updated |
|
|
MR merged |
|
|
MR reviewed |
|
|
MR approved |
|
|
Review created |
|
|
Review comment resolved |
|
Category |
Event Type |
|---|---|
|
CodeArts Pipeline |
Completed |
|
Failed |
|
|
Paused |
|
|
Suspended |
|
|
Ignored |
|
Category |
Event Type |
|---|---|
|
Check task |
Completed
|
|
Category |
Event Type |
|---|---|
|
Build task |
Task successful |
|
Task failed |
|
|
Task disabled |
|
|
Task deleted |
|
|
Task configurations updated |
|
Category |
Event Type |
|---|---|
|
Application |
Application deployed |
|
Deploy application failed |
|
|
Deploy stopped |
Constraints
- This function is now available in the AP-Singapore region.
- This function is supported only by IPD projects.
Prerequisites
You have created a CodeArts project, and your role in the project is Project Administrator or Project Manager.
Creating a Webhook
- Go to the CodeArts homepage.
- Log in to the CodeArts console, click
, and select a region where you have enabled CodeArts. - Click Go to Workspace.
If your account uses the old billing mode (see Old Billing Modes), click Access Service.
- Log in to the CodeArts console, click
- Click the target project name to go to the project.
- In the navigation pane, choose Settings > General > Notifications.
- Click the Generic Webhook tab.
- Select a service for which you want to configure notifications, and click New Webhook Subscription.
- Configure the parameters and click OK.
Figure 1 Creating a webhook (CodeArts Pipeline is used as an example.)
Table 7 Creating a webhook Parameter
Description
Name
The name of a generic webhook.
URL
URL of the HTTP server that will receive requests. Currently, only POST requests can be received.
Event Types
Event types that can trigger a generic webhook notification. For details about the supported event types, see Scenario.
HTTP Request Headers
HTTP request headers of the generic webhook notification. This parameter is optional. Configure it as needed.
HTTP request headers are part of the HTTP protocol.
When an event occurs, the service sends an HTTP request to the configured URL, along with any necessary HTTP request headers like those for authentication.
Generally, an HTTP request header is in format "key: value", for example, Content-Type: application/json.
Multiple request headers can be included in a single request, with each header on its own line. Each line should contain only one request header.
A single request header is max. 100 characters. Up to 20 request headers are allowed.
For more information about HTTP request headers, see HTTP documentation.
Custom Template
Set the request body with parameters enclosed in "${}". For example, ${eventName}. For details about the available parameters, see Event Data Structure.
The new webhook subscription is displayed.
Event Data Structure
- CodeArts Req
Table 8 Dynamic parameters of CodeArts Req Dynamic Parameter
Description
${project.id}
Project ID
${project.url}
Project URL
${issue.id}
Work item ID
${issue.title}
Work item title
${issue.url}
Work item URL
${operator.username}
Operator username
${operator.id}
Operator ID
${review.id}
Review ID
${review.title}
Review title
${review.url}
Review URL
${operation}
Event name
${event.id}
Event ID
${event.time}
Event time
- CodeArts Repo
- Repository
Subscribed Event
Event Name
Event Code
Delete repo
Repo deleted
CodeArtsRepo-Repository-Delete
Capacity warning
Capacity reached
CodeArtsRepo-Repository-CapacityWarning
{ "eventCode": "", // Event code "eventName": "", // Event name "project": { "id": "", // Project ID "url": "" // Project URL }, "repo": { "id": 0, // Repo ID "webUrl": "", // Repo access address "httpUrl": "", // Repo HTTP address "sshUrl": "", // Repo SSH address "name": "", // Repo name "groupName": "" // Organization name } "operator": { "id": 0, // Operator's user ID "nickName": "", // Operator's user alias "name": "", // Operator's username "username": "", // Operator's IAM user ID "tenantName":"" // Operator's tenant name } } - MR
Subscribed Event
Event Name
Event Code
Open MR
MR opened
CodeArtsRepo-MergeRequest-Create
Update MR
MR updated
CodeArtsRepo-MergeRequest-Update
Merge MR
MR merged
CodeArtsRepo-MergeRequest-Merge
Review MR
MR review passed
CodeArtsRepo-MergeRequest-ReviewPass
MR review canceled
CodeArtsRepo-MergeRequest-ReviewRevoke
Approve MR
MR rejected
CodeArtsRepo-MergeRequest-ApprovalReject
MR approved
CodeArtsRepo-MergeRequest-ApprovalPass
MR approving canceled
CodeArtsRepo-MergeRequest-ApprovalRevoke
Create review comment
Review comment created
CodeArtsRepo-MergeRequest-CreateComment
Resolve review comment
Review comment resolved
CodeArtsRepo-MergeRequest-Resolve
{ "eventCode": "", // Event ID "eventName": "", // Event name "project": { "id": "", // Project ID "url": "" // Project URL }, "repo": { "id": 0, // Repo ID "webUrl": "", // Repo access address "httpUrl": "", // Repo HTTP address "sshUrl": "", // Repo SSH address "name": "", // Repo name "groupName": "" // Organization name } "operator": { "id": 0, // Operator's user ID "nickName": "", // Operator's user alias "name": "", // Operator's username "username": "", // Operator's IAM user ID "tenantName":"" // Operator's tenant name }, "mergeRequest": { "id": 0, // MR ID "iid": 0, // MR IID "url":"", // MR access address "createdAt": "", // MR creation time "updatedAt": "",// MR update time "title": "", // MR title "description": "", // MR description "sourceBranch": "", // MR source branch "targetBranch": "", // MR target branch "state": "",// MR status: opened, closed, merged, locked "author": { "id": 0, // MR creator's user ID "nickName": "", // MR creator's user alias "name": "", // MR creator's username "username": "" // MR creator's IAM user ID "tenantName":"" // MR creator's tenant name } }, "mergeRequestReview": { "id": 0, // Review comment ID "body": "", // Review comment content "url": "", // Review comment access address "author": { "id": 0, // Review comment creator's user ID "nickName": "", // Review comment creator's user alias "name": "", // Review comment creator's username "username": "" // Review comment creator's IAM user ID "tenantName":"" // Review comment creator's tenant name }, "createdAt": "", // Review comment creation time "updatedAt": "",// Review comment update time } }
- Repository
- CodeArts Check
{ "eventName": "Check completed", // Event name "eventCode": "taskExecuteCompleted", // Event code "project": { "id": "", // Project ID "url": "" // Code check project URL }, "task" : { "id": "", // Task ID "name": "", // Task name "gitUrl": "", // Repo URL "creator": "" // Task creator }, "job": { "id": "", // Execution ID "startTime": "", // Task execution start time "finishTime": "", // Task execution end time "status": "", // Task status (successful, failed, or stopped) "gateResult": "", // Gate check result (passed or failed) "executor": "", // User who executed the task "url": "" // Execution record redirect link }, "issues": { "critical": "", // Number of critical issues "major": "", // Number of major issues "minor": "", // Number of minor issues "suggestion": "" // Number of suggestions } } - CodeArts Build
Table 9 Dynamic parameters of CodeArts Build Dynamic Parameter
Description
${BUILD.TITLE}
Title, for example, Build Notification.
${BUILD.URL}
Build task URL.
${BUILD.EVENT}
Task event, for example, Build task edited.
${BUILD.EXECUTOR_NAME}
Event executor, for example, User A.
${BUILD.EXECUTOR_ID}
ID of the event executor, for example, User A's ID.
${BUILD.EXECUTE_TIME}
Event execution time, for example, 2025-02-06 11:11:11.
${BUILD.TASK_NAME}
Build task name, for example, Test-Build-Task-1.
${BUILD.PROJECT_NAME}
Name of the project that the build task belongs to, for example, Test Project 1.
${BUILD.PROJECT_ID}
ID of the project that the build task belongs to, for example, ID of Test Project 1.
- CodeArts Deploy
Event Name
Event Code
Application deployed
success
Deploy application failed
failure
Deploy stopped
stop
{ "eventName": "Application deployed", // Event name "eventCode": "success", // Event code "taskName": "", // Application name "projectName": "", // Project name "result": "", // Execution result "sort": "", // Execution ID "startUser": "", // Executed by "startTime": "", // Execution time "link":""// Deployment details link } - CodeArts Pipeline
CodeArts Pipeline parameters are referenced using "${pipeline.parameter-name}", for example, ${pipeline.pipeline_id} for referencing a pipeline ID.
The parameters that can be referenced are as follows:{ "pipeline": { "pipeline_id": "", // Pipeline ID "run_number": "", // Pipeline execution ID "project_id": "", // ID of the project that the pipeline belongs to "run_id": "", // Pipeline execution ID "timestamp": "", // Pipeline execution timestamp "trigger_type": "", // Pipeline trigger type "name": "" // Pipeline name } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot