我必须在Groovy中创建这个JSON文件.我尝试了很多东西(JsonOutput.toJson()/ JsonSlurper.parseText())但没有成功.
{
"attachments":[
{
"fallback":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"pretext":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"color":"#D00000",
"fields":[
{
"title":"Notes",
"value":"This is much easier than I thought it would be.",
"short":false
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是为了向Slack发布Jenkins构建消息.