0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

XOプラットフォームから SearchAssist へドキュメント検索する場合のメッセージ ノードの設定方法

Last updated at Posted at 2023-10-16

image.png

Result(ノード名)メッセージノードにそれぞれのチャネルに対して設定が可能です。

以下Web/Mobile ClientとMS Teamsの例になります。

image.png

Web/Mobile Clientチャネル

image.png

ドロップダウンから 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チャネル

image.png

新しいチャネルを追加してドロップダウンから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))

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?