期望增加支持: 模板卡片消息
Closed this issue · 5 comments
wpecker commented
{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : "PartyID1 | PartyID2",
"totag" : "TagID1 | TagID2",
"msgtype" : "template_card",
"agentid" : 1,
"template_card" : {
}
wpecker commented
我看了,是最新的两个版本更新支持上来的, 目前企业微信最新版本是:3.1.20, 模板卡片消息是3.1.18版本新增的
模板卡片消息
投票选择型和多项选择型卡片仅企业微信3.1.12及以上版本支持
文本通知型、图文展示型和按钮交互型三种卡片仅企业微信3.1.6及以上版本支持(但附件下载功能仍需更新至3.1.12)
xen0n commented
目前我可能不会有太多时间维护这个项目(七牛的场景用不到后加的绝大多数功能,外加我上班业务写吐了回家根本不想搞同样的事情),但可能年底会 tag 1.0.0 版,新接口也会在 1.0.0 之后再加。
eryajf commented
尝试着想补充一下,结果发现底层的对象写死了,对于当前的消息,需要挺大改动的
eryajf commented
目前调整优化了原来news,mpnews的类型。准备新增template_card的时候,发消息总是报这个错误:
get err: WorkwxClientError { Code: 41016, Msg: "missing title, hint: [1695847276640293876906459], from ip: xxxxx, more info at https://open.work.weixin.qq.com/devtool/query?e=41016" }
看官方错误提示说:发送图文消息,标题是必填参数。请确认参数是否有传递。
但是命名传递的是template_card的类型,不知道为啥错误提示这里报的是图文消息呢,还没找到原因。
新增的卡片模板的方法如下:
// SendTemplateCardMessage 发送卡片模板消息
func (c *WorkwxApp) SendTemplateCardMessage(
recipient *Recipient,
template_card TemplateCard,
isSafe bool,
) error {
return c.sendMessage(
recipient,
"template_card",
map[string]interface{}{
"template_card": template_card,
}, isSafe,
)
}
其中的 TemplateCard 是对应的卡片消息体。
eryajf commented
为了便于验证,暂时将未调试通过的代码提交了,可点此查看并调试:https://github.com/eryajf/go-workwx/blob/3cb8e99271791898115dba6b65050f5a028b3aa1/message_test.go#L201