これは、ボットからクライアントアプリケーションにカスタムメッセージを送信しようとしている私のコードですdirectline
。しかし、これを通して私はペイロードまたはテキストを受け取ることができます。
var msg = new botbuilder.Message(session).sourceEvent({
directline: {
text:'Creating a note named '+note.title+ 'with description as '+ note.text,
payload:{
action: "CREATENOTE"
}
}
});
session.endDialog(msg);
クライアント側では、以下のActivity
応答があります。
{ type: 'endOfConversation',
id: '6WYDh0QKiy31ij05UbsQgV|0000006',
timestamp: '2018-04-09T05:18:23.2532985Z',
localTimestamp: '2018-04-09T05:18:23.164+00:00',
channelId: 'directline',
from: { id: 'SarthakNotesBot', name: 'SarthakNotesBot' },
conversation: { id: '6WYDh0JKiy31ij05UasQgV' },
replyToId: '6WYDh0QKiy31ij05UasQgV|0000004',
code: 'unknown' }
Activity
応答発言者code:unknown
これを直接回線で機能させる方法がわかりません。
私はそれを以下のように解決しました:
var msg = new builder.Message(session).entities([
{ action: "CREATENOTE",
payload: "other payload"
}
])
.text('Creating note named '+note.title+ ' with note description as '+ note.text);
session.endDialog(msg);
BOTでカスタムメッセージを作成する方法を以下で確認してください。
var customMessage = new builder.Message(session)
.text("Hello!")
.textFormat("plain")
.textLocale("en-us");
session.send(customMessage);
詳細については、Microsoftの公式ドキュメント「メッセージの作成」を参照してください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加