Document navigation

SNSMicrosoftTeamsTestConnection

API Request

URLs

POST zstack/v1/sns/application-endpoints/we-com/test-connection

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key\u003df8b9014a-207a-44d5-ae26-3501bf01dbc4",
    "atAll": false,
    "atPersonUserIds": [
      "zhangsan",
      "lisi"
    ],
    "testMsg": "hello",
    "endpointUuid": "1c201c27a81740ddadbc5d2f3f38a5e4"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=f8b9014a-207a-44d5-ae26-3501bf01dbc4","atAll":false,"atPersonUserIds":["zhangsan","lisi"],"testMsg":"hello","endpointUuid":"1c201c27a81740ddadbc5d2f3f38a5e4"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/we-com/test-connection

Request Parameters

Name Type Location Description Optional Value Starting Version
testMsg String body (contained in the params structure) Testing message text. 5.0.0
endpointUuid String body (contained in the params structure) Optional. The WeCom endpoint uuid. 5.0.0
systemTags List body Optional. The system tag. 5.0.0
userTags List body Optional. The user tag. 5.0.0
url String body (contained in the params structure) Optional. The webhook url. 5.0.0
atAll Boolean Optional. @all people 5.0.0
atPersonUserIds List Optional. @user id collection. 5.0.0

API Response

Sample Response

{
  "connected": true,
  "webhookResp": {}
}
Name Type Description Starting Version
success boolean 5.0.0
connected boolean The webhook url connectivity id. (connectivity only) 5.0.0
webhookResp boolean Webhook url sents a test message to the other end of the return. 5.0.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 5.0.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.0.0
description String The brief description of the error. 5.0.0
details String The details about the error. 5.0.0
elaboration String The reserved field. Default value: null. 5.0.0
opaque LinkedHashMap The reserved field. Default value: null. 5.0.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 5.0.0

SDK Sample

Java SDK

SNSWeComTestConnectionAction action = new SNSWeComTestConnectionAction();
action.url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=f8b9014a-207a-44d5-ae26-3501bf01dbc4";
action.atAll = false;
action.atPersonUserIds = asList("zhangsan","lisi");
action.testMsg = "hello";
action.endpointUuid = "1c201c27a81740ddadbc5d2f3f38a5e4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SNSWeComTestConnectionAction.Result res = action.call();

Python SDK

action = SNSWeComTestConnectionAction()
action.url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=f8b9014a-207a-44d5-ae26-3501bf01dbc4"
action.atAll = false
action.atPersonUserIds = [zhangsan, lisi]
action.testMsg = "hello"
action.endpointUuid = "1c201c27a81740ddadbc5d2f3f38a5e4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()