Closed 2nfree closed 1 year ago
测试方法如下:
var card = "{\"elements\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"width\":\"weighted\",\"weight\":1,\"vertical_align\":\"top\",\"elements\":[{\"tag\":\"div\",\"text\":{\"content\":\"**🔴 报警服务:**\\nQA 7\",\"tag\":\"lark_md\"}}]},{\"tag\":\"column\",\"width\":\"weighted\",\"weight\":1,\"vertical_align\":\"top\",\"elements\":[{\"tag\":\"div\",\"text\":{\"content\":\"**🕐 时间:**\\n2023-02-23 20:17:51\",\"tag\":\"lark_md\"}}]}]},{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"width\":\"weighted\",\"weight\":1,\"vertical_align\":\"top\",\"elements\":[{\"tag\":\"div\",\"text\":{\"content\":\"**👤 一级值班:**\\n[@王冰](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uUzN1YjL1cTN24SN3UjN?from=mcb)\",\"tag\":\"lark_md\"}}]},{\"tag\":\"column\",\"width\":\"weighted\",\"weight\":1,\"vertical_align\":\"top\",\"elements\":[{\"tag\":\"markdown\",\"content\":\"**👤 二级值班:**\\n[@李天天](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uUzN1YjL1cTN24SN3UjN?from=mcb)\"}]}]},{\"tag\":\"div\",\"text\":{\"content\":\"支付方式 支付成功率低于50%\",\"tag\":\"plain_text\"}},{\"alt\":{\"content\":\"\",\"tag\":\"plain_text\"},\"img_key\":\"img_v2_8b2ebeaf-c97c-411d-a4dc-4323e8cba10g\",\"tag\":\"img\"},{\"elements\":[{\"content\":\"🔴 支付失败数 🔵 支付成功数\",\"tag\":\"plain_text\"}],\"tag\":\"note\"},{\"actions\":[{\"tag\":\"button\",\"text\":{\"content\":\"跟进处理\",\"tag\":\"plain_text\"},\"type\":\"primary\",\"value\":{\"key1\":\"value1\"}},{\"options\":[{\"text\":{\"content\":\"屏蔽10分钟\",\"tag\":\"plain_text\"},\"value\":\"1\"},{\"text\":{\"content\":\"屏蔽30分钟\",\"tag\":\"plain_text\"},\"value\":\"2\"},{\"text\":{\"content\":\"屏蔽1小时\",\"tag\":\"plain_text\"},\"value\":\"3\"},{\"text\":{\"content\":\"屏蔽24小时\",\"tag\":\"plain_text\"},\"value\":\"4\"}],\"placeholder\":{\"content\":\"暂时屏蔽报警\",\"tag\":\"plain_text\"},\"tag\":\"select_static\",\"value\":{\"key\":\"value\"}}],\"tag\":\"action\"},{\"tag\":\"hr\"},{\"tag\":\"div\",\"text\":{\"content\":\"🙋🏼 [我要反馈误报](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-development-tutorial/introduction?from=mcb) | 📝 [录入报警处理过程](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-development-tutorial/introduction?from=mcb)\",\"tag\":\"lark_md\"}}],\"header\":{\"template\":\"red\",\"title\":{\"content\":\"1 级报警 - 数据平台\",\"tag\":\"plain_text\"}}}" var msgId = "om_b6121a512681369abd96a1a4a5197733" func TestPatch(t *testing.T) { patchBuild := larkim.NewPatchMessageReqBodyBuilder().Content(card).Build() patch := larkim.NewPatchMessageReqBuilder().MessageId(msgId).Body(patchBuild).Build() patchResp, err := client.Im.Message.Patch(context.Background(), patch) if err != nil { fmt.Println(err) } if !patchResp.Success() { fmt.Println(patchResp.Msg) } } func TestReply(t *testing.T) { replyBuild := larkim.NewReplyMessageReqBodyBuilder().Content(card).Uuid(uuid.New().String()).MsgType(larkim.MsgTypeInteractive).Build() reply := larkim.NewReplyMessageReqBuilder().MessageId(msgId).Body(replyBuild).Build() fmt.Println(reply.Body) replyResp, err := client.Im.Message.Reply(context.Background(), reply) if err != nil { fmt.Println(err) } if !replyResp.Success() { fmt.Println(replyResp.Msg) } }
卡片为飞书消息卡片工具生成的,并且通过飞书API调试台运行PATCH请求也可以正常通过 使用 client.Im.Message.Patch 会报错:Your request contains an invalid request parameter, ext=This message is NOT a card.
测试方法如下:
卡片为飞书消息卡片工具生成的,并且通过飞书API调试台运行PATCH请求也可以正常通过 使用 client.Im.Message.Patch 会报错:Your request contains an invalid request parameter, ext=This message is NOT a card.