这是我的代码,我试图通过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
不确定如何在直线上进行此工作。
答案 0 :(得分:2)
我解决了它,如下所示:
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官方文档:Create Messages