Closed10
【teams】incoming webhookからワークフローへの移行

これの対応
コメント欄は相変わらず燃えていますが、変わりそうにないので重い腰を上げる

ワークフローの作成
ここで生成されるURL宛にいろいろ送る

アダプティブカードデザイナー
GUIでテンプレートが作れる
teamsを選択
超・シンプルなやつ
payload=$(cat << EOF
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "test"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5"
}
EOF
)
コピペしたやつをpayload
変数に代入
webhook_url="さっき取得したURLをペースト"
さっき取得したURLをwebhook_url
に代入
curl -Ssi -H "Content-Type: application/json" -d "$payload" $webhook_url
送信
HTTP/1.1 202 Accepted
# 以下略
いけてそう?と思いきや投稿されない

bodyにattachmentsとかいうのがいる?
The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.

アダプティブカードで生成される型はダメらしい(なんじゃそりゃ)

これでとりあえず届く
payload=$(cat << EOF
{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type":"TextBlock",
"text":"This is notification",
"color":"warning"
}
]
}
}
]
}
EOF
)
curl -Ssi -H "Content-Type: application/json" -d "$payload" $webhook_url

マニュアルこれか?

こっちを試してみる

アダプティブカードのトースト通知はいじれないっぽい。がっくし

現在はこちらの運用でやってます
このスクラップは2024/08/26にクローズされました