Create a WeCom Endpoint

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

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": [
      "18900002222",
      "13377778888"
    ],
    "atPersonList": {
      "13377778888": "jack"
    },
    "name": "wecom"
  },
  "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":["18900002222","13377778888"],"atPersonList":{"13377778888":"jack"},"name":"wecom"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/we-com

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
urlStringbody (contained in the params structure)WeCom chatbot webhook URL 4.2.0
atALL (optional)Booleanbody (contained in the params structure)Whether to mention all members 4.2.0
atPersonUserIdsListbody (contained in the params structure)Mentioned users (user_id) 4.2.0
nameStringbody (contained in the params structure)Resource name 4.2.0
description (optional)Stringbody (contained in the params structure)Detailed description of the resource 4.2.0
resourceUuid (optional)Stringbody (contained in the params structure)Resource UUID 4.2.0
tagUuids (optional)Listbody (contained in the params structure)Tag UUID list 4.2.0
systemTags (optional)ListbodySystem tags 4.2.0
userTags (optional)ListbodyUser tags 4.2.0
atPersonListMapbody (contained in the params structure)Mentioned user information (recommended) 4.2.0

API Response

Response Example

{
  "inventory": {
    "url": "http://wecom-url",
    "atAll": false,
    "name": "example",
    "uuid": "917fe66f76b241f0843dfbd6be685fc1",
    "description": "description example",
    "type": "Email",
    "state": "Enabled",
    "platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
    "createDate": "Mar 26, 2024 2:44:19 AM",
    "lastOpDate": "Mar 26, 2024 2:44:19 AM"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.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
inventorySNSWeComEndpointInventoryFor details, see inventory4.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

inventory

NameTypeDescriptionStarting Version
urlStringWeCom chatbot webhook URL4.2.0
atAllbooleanWhether to mention all members4.2.0
atPersonUserIdsListMentioned user IDs4.2.0
nameStringResource name4.2.0
uuidStringThe UUID of the resource. Uniquely identifies the resource.4.2.0
descriptionStringDetailed description of the resource4.2.0
typeStringEndpoint type4.2.0
stateStringState4.2.0
platformUuidStringApplication platform UUID4.2.0
createDateTimestampCreation time4.2.0
lastOpDateTimestampLast modification time4.2.0
platformSNSApplicationPlatformInventoryFor details, see platform4.2.0

platform

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource.5.0.0
nameStringResource name5.0.0
descriptionStringDetailed description of the resource5.0.0
typeStringType5.0.0
createDateTimestampCreation time5.0.0
lastOpDateTimestampLast modification time5.0.0

SDK Examples

Java SDK

CreateSNSWeComEndpoint action = new CreateSNSWeComEndpoint();
action.url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key\u003df8b9014a-207a-44d5-ae26-3501bf01dbc4";
action.atAll = false;
action.atPersonUserIds = asList("18900002222","13377778888");
action.name = "wecom";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSWeComEndpoint.Result res = action.call();

Python SDK

CreateSNSWeComEndpoint action = new CreateSNSWeComEndpoint()
action.url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key\u003df8b9014a-207a-44d5-ae26-3501bf01dbc4"
action.atAll = false
action.atPersonUserIds = asList("18900002222","13377778888")
action.name = "wecom"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSWeComEndpoint.Result res = action.call()