简体   繁体   English

Directline Webchat html 代码存储值未添加到 onmessage 或 onmember

[英]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.

相关问题 如何在Webchat / DirectLine中检测对话结束? - How to detect end of dialog in Webchat/DirectLine? 将数据从漫游器发送到DirectLine WebChat中的客户端-NodeJS Botframework - Send data from bot to client in DirectLine WebChat - NodeJS Botframework 如何在BotFramwork Node.js网络聊天中隐藏直线秘密并传递令牌 - How to hide directline secret and pass token in BotFramwork Node.js webchat 使用 DirectLine 和网络聊天 (Node.js) 在 bot-framework v4 中发送输入指示器 - Send a typing indicator in bot-framework v4 using DirectLine and webchat (Node.js) 有没有办法通过 DirectLine API 和 Azure Web 应用程序使用 Oauth2 对 Microsoft Bot 框架网络聊天进行单点登录。 - Is there a way to do Single Sign On for the Microsoft Bot framework webchat via the DirectLine API and an Azure Web App using an Oauth2.0 abstraction Botframework v4 Directline集成:有没有办法将通过Directline传输到Chatbot生成的对话ID(nodejs代码) - Botframework v4 Directline integration: Is there a way to get the conversation id generated from directline transfer to the Chatbot (nodejs code) 如何使用DirectLine通道在Azure表存储中存储和检索Bot数据? - How to store & retrieve Bot Data in Azure Table storage with directLine channel? 如何始终显示来自对象的html中的值? - How to show values in html coming from object consistently? 无法通过 IE11/es5 的 botframework-webchat 中的自定义存储/调度发送消息 - Can't send a message via custom store/dispatch in botframework-webchat for IE11/es5 Websockets onMessage 函数:如果 onMessage 中的代码块的运行时间比两条消息之间的间隔时间长,会发生什么? - Websockets onMessage function: What happens if the code block within onMessage takes longer to run than interval between two messages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM