创建飞书接收端

POST/zstack/v1/sns/application-endpoints/feishu

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"
    ],
    "secret": "DPKfmrIhYXY5M2TWGXy0ed",
    "atPersonList": {
      "13377778888": "jack"
    },
    "name": "feishu"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

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"],"secret":"DPKfmrIhYXY5M2TWGXy0ed","atPersonList":{"13377778888":"jack"},"name":"feishu"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/feishu

参数列表

名字类型位置描述可选值起始版本
urlStringbody(包含在params结构中)飞书机器人Webhook URL 4.2.0
atAll (可选)Booleanbody(包含在params结构中)是否@所有人 4.2.0
atPersonUserIds (可选)Listbody(包含在params结构中)@用户id 4.2.0
nameStringbody(包含在params结构中)资源名称 4.2.0
description (可选)Stringbody(包含在params结构中)资源的详细描述 4.2.0
platformUuid (可选)Stringbody(包含在params结构中)通知平台uuid 4.2.0
resourceUuid (可选)Stringbody(包含在params结构中)资源UUID 4.2.0
tagUuids (可选)Listbody(包含在params结构中)标签UUID列表 4.2.0
systemTags (可选)Listbody系统标签 4.2.0
userTags (可选)Listbody用户标签 4.2.0
secret (可选)Stringbody(包含在params结构中)飞书秘钥 4.2.0
atPersonList (可选)Mapbody(包含在params结构中)@用户信息(推荐使用) 4.2.0

API返回

返回示例

{
  "inventory": {
    "url": "http://feishu-url",
    "atAll": false,
    "name": "example",
    "uuid": "917fe66f76b241f0843dfbd6be685fc1",
    "description": "description example",
    "type": "Email",
    "state": "Enabled",
    "platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
    "createDate": "Mar 26, 2024 2:44:26 AM",
    "lastOpDate": "Mar 26, 2024 2:44:26 AM"
  }
}
名字类型描述起始版本
successboolean 4.2.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error4.2.0
inventorySNSFeiShuEndpointInventory详情参考inventory4.2.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10015.0.0
descriptionString错误的概要描述5.0.0
detailsString错误的详细信息5.0.0
elaborationString保留字段,默认为null5.0.0
opaqueLinkedHashMap保留字段,默认为null5.0.0
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null5.0.0

inventory

名字类型描述起始版本
urlString飞书机器人url4.2.0
atAllboolean@所有人4.2.0
atPersonUserIdsList@用户id4.2.0
secretString飞书秘钥4.2.0
nameString资源名称4.2.0
uuidString资源的UUID,唯一标示该资源4.2.0
descriptionString资源的详细描述4.2.0
typeString类型4.2.0
stateString状态4.2.0
platformUuidString平台uuid4.2.0
createDateTimestamp创建时间4.2.0
lastOpDateTimestamp最后一次修改时间4.2.0
platformSNSApplicationPlatformInventory详情参考platform4.2.0

platform

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源5.0.0
nameString资源名称5.0.0
descriptionString资源的详细描述5.0.0
typeString类型5.0.0
createDateTimestamp创建时间5.0.0
lastOpDateTimestamp最后一次修改时间5.0.0

SDK示例

Java SDK

CreateSNSFeiShuEndpoint action = new CreateSNSFeiShuEndpoint();
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 = "feishu";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSFeiShuEndpoint.Result res = action.call();

Python SDK

CreateSNSFeiShuEndpoint action = new CreateSNSFeiShuEndpoint()
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 = "feishu"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSFeiShuEndpoint.Result res = action.call()