We are trying to implement the Webchat and add some extra values like IP address, browser details etc.
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. Can someone help on this?
What are the possible values on the action.type like '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.
To capture the incoming event
activity, you need to configure you bot with the onEvent() activity handler.
this.onEvent(async (context, next) => {
console.log('Event activity detected');
// do stuff
await next();
});