Result(ノード名)メッセージノードにそれぞれのチャネルに対して設定が可能です。
以下Web/Mobile ClientとMS Teamsの例になります。
Web/Mobile Clientチャネル
ドロップダウンから Web/Mobile Clientチャネルを選択し、プレーンテクストではなくて詳細を選択して以下のJSコード設定します。
Web/Mobile Client.rb
var data=context.data
var elements = [];
for (var i=0;i<data.length;i++){
var ele={
"title": data[i].file_title,
"subtitle": data[i].file_preview, //.substring(0,90)
"buttons": [{
"type": "web_url",
"title": "View Article",
"url": data[i].file_url
}]
}
elements.push(ele)
}
var message = {
"type": 'template',
"payload": {
"template_type": 'carousel',
"elements": []
}
};
message.payload.elements = elements;
print(JSON.stringify(message));
MS Teamsチャネル
新しいチャネルを追加してドロップダウンからMS Teamsを選択します。プレーンテクストではなくて詳細を選択して以下のJSコード設定します。
MS Teams.rb
var data = context.data
var message = {
"type": "message",
"speak": "",
"attachments": [{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"body": [{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Here are a few more results that might be of your interest"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5"
}
}]
}
for (var i = 0; i < data.length; i++) {
var ele = {
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": data[i].file_title,
"wrap": true
},
{
"type": "TextBlock",
"text": data[i].file_preview, //.substring(0,50)
"wrap": true
}, {
"type": "ActionSet",
"actions": [{
"type": "Action.OpenUrl",
"title": "View more",
"url": data[i].file_url
}]
}
],
"width": "stretch"
}]
}
message.attachments[0].content.body.push(ele)
}
print(JSON.stringify(message))
以上



