Test unsaved channel configuration¶
Verify channel configuration without creating an instance. This interface currently only supports the wecom_mail channel type of the wecom Provider.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/channels/{provider}/instances/test
Before you call¶
Prepare a personal access token with access to the target workspace, the target workspace ID, and the channel configuration and key to be tested.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and also asworkspace_idin the path.
provider in the path must be wecom. The request body is the same as Create channel instance; channel_type must be wecom_mail, and the required config and secrets are determined by the channel type.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/channels/wecom/instances/test" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"channel_type": "wecom_mail",
"name": "邮件通道",
"secrets": {
"<KEY>": "<VALUE>"
}
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Workspace ID. |
|
string |
Yes |
Must be |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
Yes |
Instance name. |
|
string |
No |
Example description. |
|
object |
No |
Non-sensitive configuration. |
|
object |
Required by channel type |
Keys and other sensitive configuration. |
|
string |
No |
Visible range. |
|
object |
No |
Tag key-value pair. |
Successful response¶
Returns 200 on success. This interface does not create an instance or save secrets; the instance in the result is an insensitive projection of the configuration to be tested.
{
"code": 0,
"data": {
"instance": {
"workspace_id": "ws_01",
"provider": "wecom",
"channel_type": "wecom_mail",
"name": "邮件通道",
"status": "draft"
},
"ok": true,
"status": "passed",
"last_test_status": "passed",
"last_tested_at": "2026-08-18T01:00:00Z"
}
}
A test failure may still return 200, with actionable diagnostics in the results:
{
"code": 0,
"data": {
"instance": {
"provider": "wecom",
"channel_type": "wecom_mail"
},
"ok": false,
"status": "failed",
"last_test_status": "failed",
"last_test_error": "<错误信息>",
"error_code": "<ERROR_CODE>",
"error_stage": "<STAGE>",
"provider_error_code": "<PROVIDER_CODE>",
"provider_error_message": "<PROVIDER_MESSAGE>",
"error_category": "<CATEGORY>",
"suggestion": "<SUGGESTION>",
"last_tested_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
object |
Non-sensitive instance projection of the configuration under test. |
|
boolean |
Whether the connection test passed. |
|
string |
This and the latest test status. |
|
string |
This and the latest test status. |
|
string |
The performer and request ID returned when available. |
|
string |
The performer and request ID returned when available. |
|
string |
Error message when the test fails. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
The error code, stage, and category of the service classification. |
|
string |
Error message returned by Provider; returned when available. |
|
string |
Error message returned by Provider; returned when available. |
|
string |
Actionable fix suggestion; returned when available. |
|
string |
Test time, using RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The Provider is not |
Use |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have permission to test channel configuration. |
Check workspace authorization. |
|
|
Credential access denied. |
Check credential authorization and provider side permissions. |
|
|
Channel instance services or test dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
After the test passes, Create channel instance saves the configuration.