AI Default Channel Formats
Channel Output(チャネル出力)で説明したように、Endpointに対して直接JSON形式の出力を送信し、それぞれのチャネルに出力することができます。
AIデフォルトチャネルは特別で、デフォルトチャネルからのコンテンツは自動的に他の全てのチャネルの正しいペイロードに変換されます(詳しくはSay Nodeのドキュメントをご覧ください)。
Code Nodeを使用して、AI Default ChannelのEndpointsにJSON形式の出力を送信することもでき、適切なコンテンツに変換されます。必要な形式は下記の通りです。
ペイロード形式
Text
Endpointにテキストを送信します。
actions.output("Your text", null);
クイック返信によるテキスト
テキストといくつかのクイック返信ボタンを送信します。
actions.output(null, {
"type": "quickReplies",
"_cognigy": {
"_default": {
"_quickReplies": {
"type": "quick_replies",
"text": "Quick Reply Text",
"quickReplies": [
{
"id": 111,
"contentType": "postback",
"payload": "Postback 1",
"title": "Button 1",
"imageUrl": "https://www.cognigy.com/hubfs/Cognigy.svg"
},
{
"id": 112,
"contentType": "phone_number",
"payload": "+49123456",
"title": "Button 2"
},
{
"id": 112,
"contentType": "trigger_intent",
"payload": "",
"title": "Button 3",
"intentName": "Intent Name"
}
]
}
}
}
});
ギャラリー
カードのカルーセルを出力します。
actions.output(null, {
"type": "gallery",
"_cognigy": {
"_default": {
"_gallery": {
"type": "carousel",
"items": [
{
"id": 111,
"title": "Cognigy.AI",
"subtitle": "Cognigy.AI is a conversational AI platform.",
"imageUrl": "https://www.cognigy.com/hubfs/AI%20Copy%205.svg",
"buttons": [
{
"id": 112,
"payload": "Postback 1",
"type": "postback",
"title": "Button 1"
},
{
"id": 113,
"payload": "",
"type": "web_url",
"title": "URL Button",
"url": "https://www.cognigy.com/products/cognigy-ai"
}
]
},
{
"id": 121,
"title": "Cognigy.VG",
"subtitle": "Cognigy Voice Gateway connects your AI to your contact center",
"imageUrl": "https://www.cognigy.com/hubfs/cognigy-vg-logo.svg",
"buttons": [
{
"id": 122,
"payload": "",
"type": "web_url",
"title": "Click me",
"url": "https://www.cognigy.com/products/voice-gateway"
}
]
}
],
"fallbackText": "Fallback text for voice channels"
}
}
}
});
ボタンによるテキスト
ボタンのリストとともにテキストを出力します。
actions.output(null, {
"type": "buttons",
"_cognigy": {
"_default": {
"_buttons": {
"type": "buttons",
"text": "Text with Buttons",
"buttons": [
{
"id": 111,
"payload": "Postback Value",
"type": "postback",
"title": "Postback Value Button"
},
{
"id": 112,
"payload": "",
"type": "web_url",
"title": "URL Button",
"url": "https:\\\\google.com"
},
{
"id": 113,
"payload": "+491234567",
"type": "phone_number",
"title": "Phone Number Button"
},
{
"id": 114,
"payload": "",
"type": "trigger_intent",
"title": "Intent Button",
"intentName": "Intent Name"
}
]
}
}
}
});
リスト
リストを出力します。
actions.output(null, {
"type": "list",
"_cognigy": {
"_default": {
"_list": {
"type": "list",
"items": [
{
"title": "List Item 1",
"subtitle": "Subtitle",
"imageUrl": "https://www.cognigy.com/hubfs/Cognigy.svg",
"defaultActionUrl": "",
"imageAltText": "Alternate Text",
"buttons": [
{
"type": "postback",
"payload": "Postback Value",
"title": "Postback Button"
}
]
},
{
"title": "List Item 2",
"subtitle": "",
"imageUrl": "",
"defaultActionUrl": "",
"buttons": [
{
"type": "web_url",
"payload": "",
"title": "URL Button",
"url": "https:\\\\www.google.com"
}
]
},
{
"title": "List Item 3",
"subtitle": "",
"imageUrl": "",
"defaultActionUrl": "",
"buttons": [
{
"type": "phone_number",
"payload": "+491234567",
"title": "Phone Number Button"
}
]
},
{
"title": "List Item 4",
"subtitle": "",
"imageUrl": "",
"defaultActionUrl": "",
"buttons": [
{
"type": "trigger_intent",
"payload": "",
"title": "Intent Button",
"intentName": "Intent Name"
}
]
}
],
"button": {
"type": "postback",
"condition": "",
"payload": "Postback value",
"title": "Separate Button from List"
}
}
}
}
});
オーディオ
URLからオーディオを出力します。
actions.output(null, {
"type": "audio",
"_cognigy": {
"_default": {
"_audio": {
"type": "audio",
"audioUrl": "https://audio.test/test.wav"
}
}
}
});
画像
URLから画像を出力します。
actions.output(null, {
"type": "image",
"_cognigy": {
"_default": {
"_image": {
"type": "image",
"imageUrl": "https://testURL.test/image.jpeg"
}
}
}
});
動画
URLから動画を出力します。
actions.output(null, {
"type": "video",
"_cognigy": {
"_default": {
"_video": {
"type": "video",
"videoUrl": "https://www.youtube.com/watch?v=iGc3fekZQOw"
}
}
}
});
アダプティブカード
アダプティブカードを出力します。
actions.output(null, {
"type": "adaptiveCard",
"_cognigy": {
"_default": {
"_adaptiveCard": {
"type": "adaptiveCard",
"adaptiveCard": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Publish Adaptive Card Schema"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"style": "Person",
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
"size": "Small"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "Matt Hidinger",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "None",
"text": "Created Tue, Feb 14, 2017",
"isSubtle": true,
"wrap": true
}
],
"width": "stretch"
}
]
},
{
"type": "TextBlock",
"text": "Publish Adaptive Card Schema easily.",
"wrap": true
},
{
"type": "Action.OpenUrl",
"title": "View",
"url": "https://adaptivecards.io"
}
],
"actions": [],
"version": "1.5"
}
}
}
}
});