Create callback rules

Create rules that route provider callback events to workspace resources.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/callback-rules

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare a personal access token and target workspace ID that can access the target workspace.

Confirm that the current identity has the authority to use the agent associated with the target automation task.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/callback-rules" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "provider": "github",
    "credential_ref": "credential_01",
    "name": "Issue 回调",
    "target_type": "agent_automation_task",
    "target_config": {
      "automation_task_id": "'"$AUTOMATION_TASK_ID"'"
    }
  }'

The server saves the execution subject and effective role according to the calling identity, and cannot specify other identities in the request body. Reads, lists, and deletes don’t just check the creator’s identity.

Field

Type

Required

Description

provider

string

Yes

Callback provider ID.

credential_ref

string

Yes

Provider credentials reference.

name

string

Yes

Callback rule name.

target_type

string

Yes

Callback target type. Only agent_automation_task is currently supported.

description

string

No

Callback rule description.

enabled

boolean

No

Whether to enable the rule.

priority

integer

No

Match priority.

match

object

No

Match criteria, which can include resource_kinds, event_types, event_actions, and field_equals.

target_config

object

Yes

Callback target configuration. Currently must contain automation_task_id.

stop_after_match

boolean

No

Whether to stop matching after hitting this rule.

target_config.automation_task_id

string

Yes

The automation task ID that receives the callback. The task must be enabled and trigger.mode is callback.

match.resource_kinds

array of string

No

Matching resource types.

match.event_types

array of string

No

Matching event types.

match.event_actions

array of string

No

Matching event action.

match.field_equals

object

No

Mapping of field paths to string match values.

The target automation task must belong to the current workspace, be enabled, and use callback triggering. target_config.automation_task_id Fill in the ID of the task.

Any item in each type of array can be hit, but all fields in different categories and field_equals must be satisfied. An empty array does not limit the category. Values ​​must be canonical single-line strings, field_equals allows empty string values, and field paths are dot-delimited.

Successful response

JSON
{
  "code": 0,
  "data": {
    "id": "rule_01",
    "workspace_id": "workspace_example",
    "provider": "wecom",
    "credential_ref": "cred_01",
    "name": "告警回调",
    "enabled": true,
    "priority": 0,
    "match": {
      "event_types": [
        "message"
      ]
    },
    "target_type": "agent_automation_task",
    "stop_after_match": false,
    "version": 1,
    "created_at": "2026-10-14T00:00:00Z",
    "updated_at": "2026-10-14T00:00:00Z",
    "target_config": {
      "automation_task_id": "task_01",
      "user_api_key_configured": true
    }
  }
}

Field

Type

Description

code

integer

0 when the request is processed successfully.

data

object

response data.

data.id

string

Create a new callback rule ID.

data.workspace_id

string

The workspace ID to which it belongs.

data.provider

string

Provider ID.

data.credential_ref

string

A reference to a saved credential, not a clear-text key.

data.name

string

Name.

data.description

string

Description. Can be omitted if not set.

data.enabled

boolean

Whether to enable.

data.priority

integer

Match priority.

data.match

object

Match condition.

data.match.resource_kinds

array of string

Matching resource types. Any item in the array can be hit. Can be omitted if not set.

data.match.event_types

array of string

Matching event types. Any item in the array can be hit. Can be omitted if not set.

data.match.event_actions

array of string

Matching event action. Any item in the array can be hit. Can be omitted if not set.

data.match.field_equals

object

A key-value pair of field paths and matching values. Can be omitted if not set.

data.target_type

string

Callback target type, currently agent_automation_task.

data.target_config

object

Callback target configuration and public extension fields. Can be omitted if not set.

data.target_config.automation_task_id

string

The automation task ID that receives the callback.

data.target_config.user_api_key_configured

boolean

Whether the credentials for the target call have been saved. Can be omitted if not set.

data.stop_after_match

boolean

Whether to stop matching after a hit.

data.version

integer

Version of the new rule. Fill in the version of the request body when updating.

data.created_by

string

Creator ID. Can be omitted if not set.

data.updated_by

string

Last updated by identifier. Can be omitted if not set.

data.created_at

string

Creation time, in RFC 3339 format.

data.updated_at

string

Last updated in RFC 3339 format.

Error response

JSON
{
  "code": 2,
  "message": "invalid callback rule"
}

Field

Type

Description

code

integer

error code.

message

string

Error message for the caller.

Last updated on