Test WeCom Connectivity

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=f8b9014a-207a-44d5-ae26-3501bf01dbc4",
    "atAll": false,
    "atPersonUserIds": [
      "zhangsan",
      "lisi"
    ],
    "testMsg": "hello",
    "endpointUuid": "1c201c27a81740ddadbc5d2f3f38a5e4"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.

Curl Example

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

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
testMsgStringbody (contained in the params structure)Test message 4.2.0
endpointUuid (optional)Stringbody (contained in the params structure)WeCom endpoint UUID 4.2.0
systemTags (optional)ListbodySystem tags 4.2.0
userTags (optional)ListbodyUser tags 4.2.0
url (optional)Stringbody (contained in the params structure)webhook url 4.2.0
atAll (optional)Booleanbody (contained in the params structure)Mention all members 4.2.0
atPersonUserIds (optional)Listbody (contained in the params structure)Mentioned user ID list 4.2.0

API Response

Response Example

{
  "connected": true,
  "webhookResp": {}
}
NameTypeDescriptionStarting Version
successboolean 4.2.0
connectedbooleanWhether the webhook URL is reachable4.2.0
webhookRespbooleanWebhook response data4.2.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error4.2.0

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001.5.0.0
descriptionStringA brief description of the error5.0.0
detailsStringDetailed information about the error5.0.0
elaborationStringReserved field. Default is null.5.0.0
opaqueLinkedHashMapReserved field. Default is null.5.0.0
causeErrorCodeThe root error. The source error that caused the current error. If there is no root error, this field is null.5.0.0

SDK Examples

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

SNSWeComTestConnectionAction 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"
SNSWeComTestConnectionAction.Result res = action.call()