[英]Teams message card
I am trying to post message to Microsoft Teams channel using Windows batch script but I could not make use of the Teams message card formats.我正在尝试使用 Windows 批处理脚本将消息发布到 Microsoft Teams 频道,但我无法使用 Teams 消息卡格式。 I am able to post messages using the below commands but as plain texts.
我可以使用以下命令以纯文本形式发布消息。 Is there anyway in which I can make use of the Message card JSON formats ?
无论如何,我可以使用消息卡 JSON 格式吗?
I also have some command line arguments which need to be used for the batch script so that the message displayed uses the same arguments.我还有一些命令行参数需要用于批处理脚本,以便显示的消息使用相同的参数。
curl -H "Content-type: application/json" --data "{\"@type\": \"ActionCard\",\"title\": \"New Lab %2 deployed successfully\", \"text\": \"Status is %3\"}" %1
The above command worked just fine.上面的命令工作得很好。 But doesnt satisfy my exact requirement which is described above.
但不满足我上面描述的确切要求。
I also created a seperate json file which was called as below and this worked fine but couldnt make use of command line arguments to format the JSON values.我还创建了一个单独的 json 文件,如下所示,这工作正常,但无法使用命令行参数来格式化 JSON 值。
curl --data @message.json webhook_url
message.json is as below message.json 如下
{ "summary":"New Lab deployed", "sections":[ { "activityTitle":"A <b>new lab</b> has been added!" }, { "title":"Details:", "facts":[ { "name":"Lab Name", "value":"REPLACE" }, { "name":"Status", "value":"REPLACE" } ] } ] }
cURL is able to read data from file: cURL 能够从文件中读取数据:
--data-binary "@message.json"
do not forget prepend AT sign to identify the doublequoted string is a filename, not a data itself.不要忘记添加 AT 符号以标识双引号字符串是文件名,而不是数据本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.