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.
Service |
Event Type |
|
---|---|---|
CodeArts Req |
Raw requirement |
|
System feature (SF) |
|
|
R&D requirement (IR/SR/AR) |
|
|
Task |
|
|
Bug |
|
|
Review |
|
|
CodeArts Check |
Check task |
Completed
|
CodeArts Deploy |
Application |
|
CodeArts Pipeline |
Pipeline |
|
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.
Table 2 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 Table 1.
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 3 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 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 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