Create callback rules¶
Create rules that route provider callback events to workspace resources.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/callback-rules
Before you call¶
The example below uses $AI_STUDIO_API_KEY and $WORKSPACE_ID.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/callback-rules" \
-H "X-API-Key: $AI_STUDIO_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"
}'
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The callback provider ID. |
|
string |
Yes |
Provider credentials reference. |
|
string |
Yes |
The name of the callback rule. |
|
string |
Yes |
The callback target type. |
|
string |
No |
Callback rule description. |
|
boolean |
No |
Whether to enable the rule. |
|
integer |
No |
Match priority. |
|
object |
No |
Matching criteria, which can include |
|
object |
No |
Callback target configuration. |
|
boolean |
No |
Whether to stop matching after hitting this rule. |
Successful response¶
Returns 201 and a new rule on success.
{"code":0,"data":{"id":"rule_01"}}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
New callback rule ID. |
Error response¶
{"code":2,"message":"invalid callback rule"}