Skip to content

Commit 68e8836

Browse files
Merge #59
59: add method SendTaskCardMessage r=xen0n a=zhaikangqi 添加了发送任务卡片类型的消息 Co-authored-by: zhaikangqi <794556486@qq.com>
2 parents 7d42206 + 3323939 commit 68e8836

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ in at least 2 of Qiniu's internal systems.
177177
* [x] 图文消息
178178
* [x] 图文消息(mpnews)
179179
* [x] markdown消息
180+
* [x] 任务卡片消息
180181

181182
</details>
182183

message.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,29 @@ func (c *WorkwxApp) SendMarkdownMessage(
187187
return c.sendMessage(recipient, "markdown", map[string]interface{}{"content": content}, isSafe)
188188
}
189189

190+
// SendTaskCardMessage 发送 任务卡片 消息
191+
func (c *WorkwxApp) SendTaskCardMessage(
192+
recipient *Recipient,
193+
title string,
194+
description string,
195+
url string,
196+
taskid string,
197+
btn []TaskCardBtn,
198+
isSafe bool,
199+
) error {
200+
return c.sendMessage(
201+
recipient,
202+
"taskcard",
203+
map[string]interface{}{
204+
"title": title,
205+
"description": description,
206+
"url": url,
207+
"task_id": taskid,
208+
"btn": btn,
209+
}, isSafe,
210+
)
211+
}
212+
190213
// sendMessage 发送消息底层接口
191214
//
192215
// 收件人参数如果仅设置了 `ChatID` 字段,则为【发送消息到群聊会话】接口调用;

models.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,3 +938,17 @@ type respOAGetApprovalDetail struct {
938938
// Info 审批申请详情
939939
Info OAApprovalDetail `json:"info"`
940940
}
941+
942+
// TaskCardBtn 任务卡片消息按钮
943+
type TaskCardBtn struct {
944+
// Key 按钮key值,用户点击后,会产生任务卡片回调事件,回调事件会带上该key值,只能由数字、字母和“_-@”组成,最长支持128字节
945+
Key string `json:"key"`
946+
// Name 按钮名称
947+
Name string `json:"name"`
948+
// ReplaceName 点击按钮后显示的名称,默认为“已处理”
949+
ReplaceName string `json:"replace_name"`
950+
// Color 按钮字体颜色,可选“red”或者“blue”,默认为“blue”
951+
Color string `json:"color"`
952+
// IsBold 按钮字体是否加粗,默认false
953+
IsBold bool `json:"is_bold"`
954+
}

0 commit comments

Comments
 (0)