C# 如何将数据从网站传递到botframework web聊天机器人?
我们正在构建一个MS botframework机器人,它将托管在我们控制的网站上 是否有方法将会话ID从主机网站传递到web聊天机器人小部件,以便在处理来自机器人的消息时可以访问该小部件 如果没有,是否可以按此处所述访问“t”令牌参数C# 如何将数据从网站传递到botframework web聊天机器人?,c#,botframework,C#,Botframework,我们正在构建一个MS botframework机器人,它将托管在我们控制的网站上 是否有方法将会话ID从主机网站传递到web聊天机器人小部件,以便在处理来自机器人的消息时可以访问该小部件 如果没有,是否可以按此处所述访问“t”令牌参数 谢谢目前聊天控件无法实现此功能 如果你想要更紧密的集成,你应该考虑使用直接行API并通过它建立你自己的UX经验。 如果你想要更紧密的集成,你应该考虑使用直接行API并通过它建立你自己的UX经验。 < P>可以检索在你的BOT中的消息中可用的会话ID。为此,您应该使
谢谢目前聊天控件无法实现此功能
如果你想要更紧密的集成,你应该考虑使用直接行API并通过它建立你自己的UX经验。
如果你想要更紧密的集成,你应该考虑使用直接行API并通过它建立你自己的UX经验。
< P>可以检索在你的BOT中的消息中可用的会话ID。为此,您应该使用值为“BOTCONNECTOR{your secure code}”的头授权向发出POST请求您应该收到新的令牌和conversationId作为结果或请求。令牌用于iframe标记创建,conversationId可用作会话令牌。可以检索会话ID,该会话ID可在bot中的消息中找到。为此,您应该使用值为“BOTCONNECTOR{your secure code}”的头授权向发出POST请求
您应该收到新的令牌和conversationId作为结果或请求。该令牌用于iframe标记创建,conversationId可用作会话令牌。使用DirectLine和Backchannel可能会对您有所帮助。如果滚动到最后一节,您将在自述文件中找到此信息。它允许Webchat和主机相互发送/接收您想要的任何信息
<body onload="postLoadMessage()">
<div id="BotChatGoesHere" class="wc-narrow"></div>
<script src="botchat.js"></script>
<script>
var params = BotChat.queryParams(location.search);
var user = { id: '***' };
var bot = { id: '***' };
window['botchatDebug'] = params['debug'] && params['debug'] === "true";
var botConnection = new BotChat.DirectLine({
secret: '****',
token: params['t'],
domain: params['domain'],
webSocket: params['webSocket'] && params['webSocket'] === "true" // defaults to true
});
BotChat.App({
botConnection: botConnection,
user: user,
bot: bot
}, document.getElementById("BotChatGoesHere"));
//var x= whatever value you want to send;
const postLoadMessage = () => {
botConnection
.postActivity({type: "event", value: x , from: {id: "me" }, name: "PageLoaded"})
.subscribe(id => console.log("success"));
}
</script>
</body>
var params=BotChat.queryParams(location.search);
var user={id:'***'};
var bot={id:'***'};
窗口['botchatDebug']=params['debug']&¶ms['debug']==“true”;
var botConnection=new BotChat.DirectLine({
秘密:'**',
令牌:params['t'],
域:参数['domain'],
webSocket:params['webSocket']&¶ms['webSocket']==“true”//默认为true
});
BotChat.App({
botConnection:botConnection,
用户:用户,,
机器人:机器人
},document.getElementById(“botchatgoesher”);
//var x=要发送的任何值;
const postLoadMessage=()=>{
僵尸连接
.postActivity({type:“event”,value:x,from:{id:“me”},name:“PageLoaded”})
.subscribe(id=>console.log(“成功”));
}
上面给出的代码是我在加载带有bot的页面时如何使用它发送值x的
我希望这能有所帮助:)使用直接线路和反向通道可能会对您有所帮助。如果滚动到最后一节,您将在自述文件中找到此信息。它允许Webchat和主机相互发送/接收您想要的任何信息
<body onload="postLoadMessage()">
<div id="BotChatGoesHere" class="wc-narrow"></div>
<script src="botchat.js"></script>
<script>
var params = BotChat.queryParams(location.search);
var user = { id: '***' };
var bot = { id: '***' };
window['botchatDebug'] = params['debug'] && params['debug'] === "true";
var botConnection = new BotChat.DirectLine({
secret: '****',
token: params['t'],
domain: params['domain'],
webSocket: params['webSocket'] && params['webSocket'] === "true" // defaults to true
});
BotChat.App({
botConnection: botConnection,
user: user,
bot: bot
}, document.getElementById("BotChatGoesHere"));
//var x= whatever value you want to send;
const postLoadMessage = () => {
botConnection
.postActivity({type: "event", value: x , from: {id: "me" }, name: "PageLoaded"})
.subscribe(id => console.log("success"));
}
</script>
</body>
var params=BotChat.queryParams(location.search);
var user={id:'***'};
var bot={id:'***'};
窗口['botchatDebug']=params['debug']&¶ms['debug']==“true”;
var botConnection=new BotChat.DirectLine({
秘密:'**',
令牌:params['t'],
域:参数['domain'],
webSocket:params['webSocket']&¶ms['webSocket']==“true”//默认为true
});
BotChat.App({
botConnection:botConnection,
用户:用户,,
机器人:机器人
},document.getElementById(“botchatgoesher”);
//var x=要发送的任何值;
const postLoadMessage=()=>{
僵尸连接
.postActivity({type:“event”,value:x,from:{id:“me”},name:“PageLoaded”})
.subscribe(id=>console.log(“成功”));
}
上面给出的代码是我在加载带有bot的页面时如何使用它发送值x的
我希望这有帮助:)