[英]Directline Webchat html code store values not coming to onmessage or onmember added
We are trying to implement the Webchat and add some extra values like IP address, browser details etc.我们正在尝试实现网络聊天并添加一些额外的值,例如 IP 地址、浏览器详细信息等。
Adding these values using使用添加这些值
if (action.type === 'DIRECT_LINE/POST_ACTIVITY') {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'start-chat',
value: {
"browser": Browser,
"ipAddress": ipAddress,
"location": Location,
"phoneNumber":sessiondata.phone_number
}
}
});
}
these values are coming in request and context.activity also
{
type: 'event',
id: '**********',
timestamp: 2022-09-13T11:37:27.491Z,
localTimestamp: 2022-09-13T11:37:27.282Z,
localTimezone: 'Asia/Calcutta',
serviceUrl: 'https://directline.botframework.com/',
channelId: 'directline',
from: { id: '******', name: 'name', role: 'user' },
conversation: { id: '********' },
recipient: { id: '*******', name: '******' },
locale: 'en-US',
entities: [
{
type: 'ClientCapabilities',
requiresBotState: true,
supportsListening: true,
supportsTts: true
}
],
channelData: {
clientActivityID: '*******',
clientTimestamp: '2022-09-13T11:37:27.282Z'
},
value: {
browser: 'Chrome',
ipAddress: '*******',
location: 'Payyanur,Kerala,India',
phoneNumber: '11111'
},
name: 'start-chat'
}
but these values are not coming to onmemberadded or onmessage context.但这些值不会出现在 onmemberadd 或 onmessage 上下文中。 Can someone help on this?
有人可以帮忙吗?
What are the possible values on the action.type like 'DIRECT_LINE/POST_ACTIVITY' action.type 上的可能值是什么,例如“DIRECT_LINE/POST_ACTIVITY”
You are posting an activity using the 'WEB_CHAT/SEND_EVENT' type which means the activity received by the bot will be of an event
type.您正在使用“WEB_CHAT/SEND_EVENT”类型发布活动,这意味着机器人收到的活动将属于
event
类型。
To capture the incoming event
activity, you need to configure you bot with the onEvent() activity handler.要捕获传入的
event
活动,您需要使用onEvent()活动处理程序配置您的机器人。
this.onEvent(async (context, next) => {
console.log('Event activity detected');
// do stuff
await next();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.