diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d0bddd92..834cea5233 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to Botonic will be documented in this file.
- Changes that have landed in master but are not yet released. + Changes that have landed in master-lts but are not yet released. Click to see more. diff --git a/package-lock.json b/package-lock.json index 71dbc67901..70f2fb5800 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25032,11 +25032,11 @@ }, "packages/botonic-plugin-hubtype-analytics": { "name": "@botonic/plugin-hubtype-analytics", - "version": "0.30.2", + "version": "0.31.0-alpha.0", "license": "MIT", "dependencies": { "@babel/runtime": "^7.21.0", - "@botonic/core": "^0.30.0", + "@botonic/core": "0.31.0-alpha.1", "axios": "^1.7.2" }, "devDependencies": { @@ -25045,22 +25045,6 @@ "typescript": "^4.9.5" } }, - "packages/botonic-plugin-hubtype-analytics/node_modules/@botonic/core": { - "version": "0.30.2", - "license": "MIT", - "dependencies": { - "@babel/plugin-transform-runtime": "^7.23.9", - "axios": "^1.7.2", - "decode": "^0.3.0", - "pako": "^2.1.0", - "process": "^0.11.10", - "pusher-js": "^5.1.1", - "ulid": "^2.3.0" - }, - "engines": { - "node": ">=20.0.0" - } - }, "packages/botonic-plugin-hubtype-analytics/node_modules/@types/react": { "version": "16.14.62", "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.62.tgz", diff --git a/packages/botonic-plugin-flow-builder/CHANGELOG.md b/packages/botonic-plugin-flow-builder/CHANGELOG.md new file mode 100644 index 0000000000..a237558aef --- /dev/null +++ b/packages/botonic-plugin-flow-builder/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to Botonic will be documented in this file. + +## [Unreleased] + +
+ + Changes that have landed in master-lts but are not yet released. + Click to see more. + + +## [0.31.0] - 2024-mm-dd + +### Added + +### Changed + +- [create nlu and knowledgebase events with `flow_thread_id, flow_node_id and flow_id attributes`](https://github.com/hubtype/botonic/pull/2960) + +### Fixed + +
diff --git a/packages/botonic-plugin-flow-builder/src/action/knowledge-bases.ts b/packages/botonic-plugin-flow-builder/src/action/knowledge-bases.ts index 1d0e237eb2..e82b86c132 100644 --- a/packages/botonic-plugin-flow-builder/src/action/knowledge-bases.ts +++ b/packages/botonic-plugin-flow-builder/src/action/knowledge-bases.ts @@ -1,6 +1,7 @@ import { ActionRequest } from '@botonic/react' import { FlowContent, FlowKnowledgeBase } from '../content-fields' +import { HtNodeWithContent } from '../content-fields/hubtype-fields/nodes' import { EventAction, KnowledgebaseFailReason, trackEvent } from '../tracking' import { KnowledgeBaseFunction, KnowledgeBaseResponse } from '../types' import { inputHasTextData } from '../utils' @@ -32,6 +33,9 @@ export async function getContentsByKnowledgeBase({ } const sourceIds = knowledgeBaseContent.sourcesData.map(source => source.id) + const flowId = cmsApi.getNodeById( + knowledgeBaseContent.id + ).flow_id if ( flowBuilderPlugin.getKnowledgeBaseResponse && @@ -43,7 +47,8 @@ export async function getContentsByKnowledgeBase({ flowBuilderPlugin.getKnowledgeBaseResponse, request, contents, - sourceIds + knowledgeBaseContent, + flowId ) if (contentsWithKnowledgeResponse) { @@ -58,14 +63,21 @@ async function getContentsWithKnowledgeResponse( getKnowledgeBaseResponse: KnowledgeBaseFunction, request: ActionRequest, contents: FlowContent[], - sourceIds: string[] + knowledgeBaseContent: FlowKnowledgeBase, + flowId: string ): Promise { + const sourceIds = knowledgeBaseContent.sourcesData.map(source => source.id) const knowledgeBaseResponse = await getKnowledgeBaseResponse( request, request.input.data!, sourceIds ) - await trackKnowledgeBase(knowledgeBaseResponse, request, sourceIds) + await trackKnowledgeBase( + knowledgeBaseResponse, + request, + knowledgeBaseContent, + flowId + ) if ( !knowledgeBaseResponse.hasKnowledge || @@ -94,12 +106,16 @@ function updateContentsWithResponse( async function trackKnowledgeBase( response: KnowledgeBaseResponse, request: ActionRequest, - sourceIds: string[] + knowledgeBaseContent: FlowKnowledgeBase, + flowId: string ) { + const sourceIds = knowledgeBaseContent.sourcesData.map(source => source.id) const knowledgebaseInferenceId = response.inferenceId const knowledgebaseSourcesIds = sourceIds const knowledgebaseChunksIds = response.chunkIds const knowledgebaseMessageId = request.input.message_id + const flowThreadId = request.session.flow_thread_id + const flowNodeId = knowledgeBaseContent.id let knowledgebaseFailReason: KnowledgebaseFailReason | undefined @@ -118,5 +134,8 @@ async function trackKnowledgeBase( knowledgebaseChunksIds, knowledgebaseMessageId, userInput: request.input.data, + flowThreadId, + flowId, + flowNodeId, }) } diff --git a/packages/botonic-plugin-flow-builder/src/user-input/intent.ts b/packages/botonic-plugin-flow-builder/src/user-input/intent.ts index 95913160eb..eec7ddf4ef 100644 --- a/packages/botonic-plugin-flow-builder/src/user-input/intent.ts +++ b/packages/botonic-plugin-flow-builder/src/user-input/intent.ts @@ -32,6 +32,9 @@ async function trackIntentEvent( nluIntentThreshold: intentNode?.content.confidence, nluIntentMessageId: request.input.message_id, userInput: request.input.data, + flowThreadId: request.session.flow_thread_id, + flowId: intentNode.flow_id, + flowNodeId: intentNode.id, } await trackEvent(request, EventAction.Intent, eventArgs) } diff --git a/packages/botonic-plugin-flow-builder/src/user-input/keyword.ts b/packages/botonic-plugin-flow-builder/src/user-input/keyword.ts index f6cb87bd1b..32c90b81d1 100644 --- a/packages/botonic-plugin-flow-builder/src/user-input/keyword.ts +++ b/packages/botonic-plugin-flow-builder/src/user-input/keyword.ts @@ -2,7 +2,10 @@ import { ActionRequest } from '@botonic/react' import { FlowBuilderApi } from '../api' import { REG_EXP_PATTERN } from '../constants' -import { HtKeywordNode } from '../content-fields/hubtype-fields' +import { + HtKeywordNode, + HtNodeWithContent, +} from '../content-fields/hubtype-fields' import { EventAction, trackEvent } from '../tracking' interface KeywordProps { @@ -17,6 +20,7 @@ export class KeywordMatcher { public isRegExp: boolean public matchedKeyword?: string public keywordNodeId?: string + public flowId?: string constructor({ cmsApi, locale, request }: KeywordProps) { this.cmsApi = cmsApi @@ -50,6 +54,9 @@ export class KeywordMatcher { const result = node.content.keywords.find(keywords => { if (keywords.locale === this.locale) { this.keywordNodeId = node.id + this.flowId = this.cmsApi.getNodeById( + node.id + ).flow_id return this.inputMatchesAnyKeyword(userInput, keywords.values) } @@ -87,11 +94,13 @@ export class KeywordMatcher { private async trackKeywordEvent() { const eventArgs = { - nluKeywordId: this.keywordNodeId, nluKeywordName: this.matchedKeyword, nluKeywordIsRegex: this.isRegExp, nluKeywordMessageId: this.request.input.message_id, userInput: this.request.input.data, + flowThreadId: this.request.session.flow_thread_id, + flowId: this.flowId, + flowNodeId: this.keywordNodeId, } await trackEvent(this.request, EventAction.Keyword, eventArgs) } diff --git a/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts b/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts index 6ba9c96e9e..a2e57ae5a6 100644 --- a/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts +++ b/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts @@ -23,7 +23,8 @@ export class SmartIntentsApi { constructor( public cmsApi: FlowBuilderApi, public currentRequest: ActionRequest, - public smartIntentsConfig: SmartIntentsInferenceConfig + public smartIntentsConfig: SmartIntentsInferenceConfig, + public flowId?: string ) {} async getNodeByInput(): Promise { @@ -50,6 +51,9 @@ export class SmartIntentsApi { nluIntentSmartNumUsed: response.data.smart_intents_used.length, nluIntentSmartMessageId: this.currentRequest.input.message_id, userInput: this.currentRequest.input.data, + flowThreadId: this.currentRequest.session.flow_thread_id, + flowId: smartIntentNode.flow_id, + flowNodeId: smartIntentNode.id, }) return smartIntentNode } diff --git a/packages/botonic-plugin-flow-builder/tests/helpers/utils.ts b/packages/botonic-plugin-flow-builder/tests/helpers/utils.ts index a74e50d154..ac414c5f12 100644 --- a/packages/botonic-plugin-flow-builder/tests/helpers/utils.ts +++ b/packages/botonic-plugin-flow-builder/tests/helpers/utils.ts @@ -72,6 +72,7 @@ export function createRequest({ _access_token: 'fake_access_token', _hubtype_api: 'https://api.hubtype.com', is_test_integration: false, + flow_thread_id: 'testFlowThreadId', }, input: { bot_interaction_id: 'testInteractionId', diff --git a/packages/botonic-plugin-flow-builder/tests/tracking/track-keyword.test.ts b/packages/botonic-plugin-flow-builder/tests/tracking/track-keyword.test.ts index 3a919ed87b..b77ef9d03e 100644 --- a/packages/botonic-plugin-flow-builder/tests/tracking/track-keyword.test.ts +++ b/packages/botonic-plugin-flow-builder/tests/tracking/track-keyword.test.ts @@ -32,7 +32,9 @@ describe('Check tracked events when a contents are displayed', () => { expect.anything(), 'nlu_keyword', { - nluKeywordId: '8ec6a479-dca5-4623-8bab-41fa49c9d6e8', + flowId: '43a736f8-4837-4fbb-a661-021291749b4f', + flowNodeId: '8ec6a479-dca5-4623-8bab-41fa49c9d6e8', + flowThreadId: 'testFlowThreadId', nluKeywordName: 'flowText', nluKeywordIsRegex: false, nluKeywordMessageId: expect.anything(), diff --git a/packages/botonic-plugin-flow-builder/tests/tracking/track-knowledge-base.test.ts b/packages/botonic-plugin-flow-builder/tests/tracking/track-knowledge-base.test.ts index f740104dd5..597938e1db 100644 --- a/packages/botonic-plugin-flow-builder/tests/tracking/track-knowledge-base.test.ts +++ b/packages/botonic-plugin-flow-builder/tests/tracking/track-knowledge-base.test.ts @@ -56,6 +56,9 @@ describe('Check tracked events when a bot generates a response using a knowledge knowledgebaseChunksIds: ['sourceChunkId1', 'sourceChunkId2'], knowledgebaseMessageId: 'testMessageId', userInput: 'What is Flow Builder?', + flowId: '4c8acc81-accd-529e-8bb6-d17f4cafafea', + flowNodeId: 'b2ac9457-6928-41ea-9474-911133a75ff4', + flowThreadId: 'testFlowThreadId', } ) }) diff --git a/packages/botonic-plugin-flow-builder/tests/tracking/track-smart-intent.test.ts b/packages/botonic-plugin-flow-builder/tests/tracking/track-smart-intent.test.ts index bc9d65de09..7338803f1a 100644 --- a/packages/botonic-plugin-flow-builder/tests/tracking/track-smart-intent.test.ts +++ b/packages/botonic-plugin-flow-builder/tests/tracking/track-smart-intent.test.ts @@ -35,6 +35,9 @@ describe('Check tracked events when a contents are displayed after match with sm nluIntentSmartNumUsed: 2, nluIntentSmartMessageId: expect.anything(), userInput: 'How can I add a bag to my booking?', + flowId: '8d527e7d-ea6d-5422-b810-5b4c8be7657b', + flowNodeId: 'a962b2e5-9424-4fe5-81bd-8cb398b59875', + flowThreadId: 'testFlowThreadId', } ) expect(trackEventMock).toHaveBeenNthCalledWith( diff --git a/packages/botonic-plugin-hubtype-analytics/CHANGELOG.md b/packages/botonic-plugin-hubtype-analytics/CHANGELOG.md new file mode 100644 index 0000000000..1c11de35ff --- /dev/null +++ b/packages/botonic-plugin-hubtype-analytics/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to Botonic will be documented in this file. + +## [Unreleased] + +
+ + Changes that have landed in master-lts but are not yet released. + Click to see more. + + +## [0.31.0] - 2024-mm-dd + +### Added + +### Changed + +- [`add flow_thread_id, flow_node_id and flow_id` in nlu and knowledgebase events](https://github.com/hubtype/botonic/pull/2960) + +### Fixed + +
diff --git a/packages/botonic-plugin-hubtype-analytics/README.md b/packages/botonic-plugin-hubtype-analytics/README.md index 416dbe3cee..f13d84ddc1 100644 --- a/packages/botonic-plugin-hubtype-analytics/README.md +++ b/packages/botonic-plugin-hubtype-analytics/README.md @@ -17,17 +17,19 @@ npm i @botonic/plugin-hubtype-analytics You can define two optional functions to obtain the language and the country. By default if you do not define these functions it will use the language defined in request.session.user.extra_data.language and country defined in request.session.user.extra_data.country -``` - export const plugins = [ - { - id: 'hubtype-analytics', - resolve: require('@botonic/plugin-hubtype-analytics'), - options: { - getLaguange?: (request: BotRequest) => request.session.user.extra_data.lang - getCountry?: (request: BotRequest) => request.session.user.extra_data.store - }, +```typescript +export const plugins = [ + { + id: 'hubtype-analytics', + resolve: require('@botonic/plugin-hubtype-analytics'), + options: { + getLaguange: (request: BotRequest) => + request.session.user.extra_data.lang, + getCountry: (request: BotRequest) => + request.session.user.extra_data.store, }, - ] + }, +] ``` ## Plugin Options @@ -60,7 +62,7 @@ export class WelcomeAction extends FlowBuilderMultichannelAction { } ``` -- To track a handoff, you can use an instance of `HandOffBuilder` from `@botonic/core` `handoffBuilder.withBotEvent()` so thaht the backend will create the event after the handoff has been done correctly. +- To track a handoff, you can use an instance of `HandOffBuilder` from `@botonic/core` `handoffBuilder.withBotEvent()` so that the backend will create the event after the handoff has been done correctly. ```typescript const handOffBuilder = new HandOffBuilder(request.session) diff --git a/packages/botonic-plugin-hubtype-analytics/package.json b/packages/botonic-plugin-hubtype-analytics/package.json index 7a24b5caab..f7da857eb4 100644 --- a/packages/botonic-plugin-hubtype-analytics/package.json +++ b/packages/botonic-plugin-hubtype-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@botonic/plugin-hubtype-analytics", - "version": "0.30.2", + "version": "0.31.0-alpha.0", "description": "Plugin for tracking in the Hubtype backend to see the results in the Hubtype Dashbord", "main": "./lib/cjs/index.js", "module": "./lib/esm/index.js", @@ -14,7 +14,7 @@ }, "dependencies": { "@babel/runtime": "^7.21.0", - "@botonic/core": "^0.30.0", + "@botonic/core": "0.31.0-alpha.1", "axios": "^1.7.2" }, "devDependencies": { diff --git a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent-smart.ts b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent-smart.ts index 415ec02da3..3b053c2c0c 100644 --- a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent-smart.ts +++ b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent-smart.ts @@ -6,6 +6,9 @@ export class HtEventIntentSmart extends HtEvent { nlu_intent_smart_num_used: number nlu_intent_smart_message_id: string user_input: string + flow_thread_id: string + flow_id: string + flow_node_id: string constructor(event: EventIntentSmart, requestData: RequestData) { super(event, requestData) @@ -15,5 +18,8 @@ export class HtEventIntentSmart extends HtEvent { this.nlu_intent_smart_num_used = event.nluIntentSmartNumUsed this.nlu_intent_smart_message_id = event.nluIntentSmartMessageId this.user_input = event.userInput + this.flow_thread_id = event.flowThreadId + this.flow_id = event.flowId + this.flow_node_id = event.flowNodeId } } diff --git a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent.ts b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent.ts index 50e2894d74..8b1bbccc9a 100644 --- a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent.ts +++ b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-intent.ts @@ -7,6 +7,9 @@ export class HtEventIntent extends HtEvent { nlu_intent_threshold: number nlu_intent_message_id: string user_input: string + flow_thread_id: string + flow_id: string + flow_node_id: string constructor(event: EventIntent, requestData: RequestData) { super(event, requestData) @@ -17,5 +20,8 @@ export class HtEventIntent extends HtEvent { this.nlu_intent_threshold = event.nluIntentThreshold this.nlu_intent_message_id = event.nluIntentMessageId this.user_input = event.userInput + this.flow_thread_id = event.flowThreadId + this.flow_id = event.flowId + this.flow_node_id = event.flowNodeId } } diff --git a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-keyword.ts b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-keyword.ts index 4f5ea1302d..43c896a322 100644 --- a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-keyword.ts +++ b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-keyword.ts @@ -2,20 +2,24 @@ import { EventAction, EventKeyword, EventType, RequestData } from '../types' import { HtEvent } from './ht-event' export class HtEventKeyword extends HtEvent { - nlu_keyword_id: string nlu_keyword_name: string nlu_keyword_is_regex: boolean nlu_keyword_message_id: string user_input: string + flow_thread_id: string + flow_id: string + flow_node_id: string constructor(event: EventKeyword, requestData: RequestData) { super(event, requestData) this.type = EventType.BotEvent this.action = EventAction.Keyword - this.nlu_keyword_id = event.nluKeywordId this.nlu_keyword_name = event.nluKeywordName this.nlu_keyword_is_regex = event.nluKeywordIsRegex || false this.nlu_keyword_message_id = event.nluKeywordMessageId this.user_input = event.userInput + this.flow_thread_id = event.flowThreadId + this.flow_id = event.flowId + this.flow_node_id = event.flowNodeId } } diff --git a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-knowledge-base.ts b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-knowledge-base.ts index f1c9b7e85d..fe2d11c74d 100644 --- a/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-knowledge-base.ts +++ b/packages/botonic-plugin-hubtype-analytics/src/event-models/ht-event-knowledge-base.ts @@ -13,6 +13,9 @@ export class HtEventKnowledgeBase extends HtEvent { knowledgebase_chunks_ids: string[] knowledgebase_message_id: string user_input: string + flow_thread_id: string + flow_id: string + flow_node_id: string constructor(event: EventKnowledgeBase, requestData: RequestData) { super(event, requestData) @@ -24,5 +27,8 @@ export class HtEventKnowledgeBase extends HtEvent { this.knowledgebase_chunks_ids = event.knowledgebaseChunksIds this.knowledgebase_message_id = event.knowledgebaseMessageId this.user_input = event.userInput + this.flow_thread_id = event.flowThreadId + this.flow_id = event.flowId + this.flow_node_id = event.flowNodeId } } diff --git a/packages/botonic-plugin-hubtype-analytics/src/types.ts b/packages/botonic-plugin-hubtype-analytics/src/types.ts index df2c5a75a9..0aa4a6ceaf 100644 --- a/packages/botonic-plugin-hubtype-analytics/src/types.ts +++ b/packages/botonic-plugin-hubtype-analytics/src/types.ts @@ -85,6 +85,9 @@ export interface EventHandoffOption extends HtBaseEventProps { export interface EventIntent extends HtBaseEventProps { action: EventAction.Intent + flowThreadId: string + flowId: string + flowNodeId: string nluIntentLabel: string nluIntentConfidence: number nluIntentThreshold: number @@ -94,7 +97,9 @@ export interface EventIntent extends HtBaseEventProps { export interface EventKeyword extends HtBaseEventProps { action: EventAction.Keyword - nluKeywordId: string + flowThreadId: string + flowId: string + flowNodeId: string nluKeywordName: string nluKeywordIsRegex?: boolean nluKeywordMessageId: string @@ -103,6 +108,9 @@ export interface EventKeyword extends HtBaseEventProps { export interface EventIntentSmart extends HtBaseEventProps { action: EventAction.IntentSmart + flowThreadId: string + flowId: string + flowNodeId: string nluIntentSmartTitle: string nluIntentSmartNumUsed: number nluIntentSmartMessageId: string @@ -111,6 +119,9 @@ export interface EventIntentSmart extends HtBaseEventProps { export interface EventKnowledgeBase extends HtBaseEventProps { action: EventAction.Knowledgebase + flowThreadId: string + flowId: string + flowNodeId: string knowledgebaseInferenceId: string knowledgebaseFailReason?: KnowledgebaseFailReason knowledgebaseSourcesIds: string[] diff --git a/packages/botonic-plugin-hubtype-analytics/tests/event-intent-smart.test.ts b/packages/botonic-plugin-hubtype-analytics/tests/event-intent-smart.test.ts index 19cc9326ac..9f06666d9f 100644 --- a/packages/botonic-plugin-hubtype-analytics/tests/event-intent-smart.test.ts +++ b/packages/botonic-plugin-hubtype-analytics/tests/event-intent-smart.test.ts @@ -10,6 +10,9 @@ describe('Create nlu intent smart events', () => { nluIntentSmartNumUsed: 2, nluIntentSmartMessageId: 'messageId', userInput: 'Add a bag', + flowThreadId: 'flowThreadId', + flowId: 'flowId', + flowNodeId: 'nluIntentSmartNodeId', }) expect(htEvent).toEqual({ @@ -22,6 +25,9 @@ describe('Create nlu intent smart events', () => { nlu_intent_smart_num_used: 2, nlu_intent_smart_message_id: 'messageId', user_input: 'Add a bag', + flow_thread_id: 'flowThreadId', + flow_id: 'flowId', + flow_node_id: 'nluIntentSmartNodeId', bot_interaction_id: 'testInteractionId', type: EventType.BotEvent, }) diff --git a/packages/botonic-plugin-hubtype-analytics/tests/event-intent.test.ts b/packages/botonic-plugin-hubtype-analytics/tests/event-intent.test.ts index 72fa393044..f815cff213 100644 --- a/packages/botonic-plugin-hubtype-analytics/tests/event-intent.test.ts +++ b/packages/botonic-plugin-hubtype-analytics/tests/event-intent.test.ts @@ -11,6 +11,9 @@ describe('Create nlu intent classic events', () => { nluIntentThreshold: 0.6, nluIntentMessageId: 'nluIntentMessageId', userInput: 'Add a bag', + flowThreadId: 'flowThreadId', + flowId: 'flowId', + flowNodeId: 'nluIntentNodeId', }) expect(htEvent).toEqual({ @@ -24,6 +27,9 @@ describe('Create nlu intent classic events', () => { nlu_intent_threshold: 0.6, nlu_intent_message_id: 'nluIntentMessageId', user_input: 'Add a bag', + flow_thread_id: 'flowThreadId', + flow_id: 'flowId', + flow_node_id: 'nluIntentNodeId', bot_interaction_id: 'testInteractionId', type: EventType.BotEvent, }) diff --git a/packages/botonic-plugin-hubtype-analytics/tests/event-keyword.test.ts b/packages/botonic-plugin-hubtype-analytics/tests/event-keyword.test.ts index e985c57c03..6868dc2318 100644 --- a/packages/botonic-plugin-hubtype-analytics/tests/event-keyword.test.ts +++ b/packages/botonic-plugin-hubtype-analytics/tests/event-keyword.test.ts @@ -6,11 +6,13 @@ describe('Create nlu keyword events', () => { test('should create keyword event', () => { const htEvent = createHtEvent(requestData, { action: EventAction.Keyword, - nluKeywordId: 'keywordId', nluKeywordName: 'hello', nluKeywordIsRegex: false, nluKeywordMessageId: 'messageId', userInput: 'hello', + flowThreadId: 'flowThreadId', + flowId: 'flowId', + flowNodeId: 'keywordNodeId', }) expect(htEvent).toEqual({ @@ -19,11 +21,13 @@ describe('Create nlu keyword events', () => { chat_country: 'ES', format_version: 2, action: EventAction.Keyword, - nlu_keyword_id: 'keywordId', nlu_keyword_name: 'hello', nlu_keyword_is_regex: false, nlu_keyword_message_id: 'messageId', user_input: 'hello', + flow_thread_id: 'flowThreadId', + flow_id: 'flowId', + flow_node_id: 'keywordNodeId', bot_interaction_id: 'testInteractionId', type: EventType.BotEvent, }) diff --git a/packages/botonic-plugin-hubtype-analytics/tests/event-knowledge-base.test.ts b/packages/botonic-plugin-hubtype-analytics/tests/event-knowledge-base.test.ts index ebca0564f8..e03ba17026 100644 --- a/packages/botonic-plugin-hubtype-analytics/tests/event-knowledge-base.test.ts +++ b/packages/botonic-plugin-hubtype-analytics/tests/event-knowledge-base.test.ts @@ -16,6 +16,9 @@ describe('Create knowledge base events', () => { knowledgebaseChunksIds: ['cunkId1', 'chunkId2', 'chunkId3'], knowledgebaseMessageId: 'knowledgebaseMessageId', userInput: 'What is Flow Builder?', + flowThreadId: 'flowThreadId', + flowId: 'flowId', + flowNodeId: 'knowledgebaseNodeId', }) expect(htEvent).toEqual({ @@ -29,6 +32,9 @@ describe('Create knowledge base events', () => { knowledgebase_chunks_ids: ['cunkId1', 'chunkId2', 'chunkId3'], knowledgebase_message_id: 'knowledgebaseMessageId', user_input: 'What is Flow Builder?', + flow_thread_id: 'flowThreadId', + flow_id: 'flowId', + flow_node_id: 'knowledgebaseNodeId', bot_interaction_id: 'testInteractionId', type: EventType.BotEvent, }) @@ -43,6 +49,9 @@ describe('Create knowledge base events', () => { knowledgebaseChunksIds: ['cunkId1', 'chunkId2', 'chunkId3'], knowledgebaseMessageId: 'knowledgebaseMessageId', userInput: 'What is Flow Builder?', + flowThreadId: 'flowThreadId', + flowId: 'flowId', + flowNodeId: 'knowledgebaseNodeId', }) expect(htEvent).toEqual({ @@ -57,6 +66,9 @@ describe('Create knowledge base events', () => { knowledgebase_chunks_ids: ['cunkId1', 'chunkId2', 'chunkId3'], knowledgebase_message_id: 'knowledgebaseMessageId', user_input: 'What is Flow Builder?', + flow_thread_id: 'flowThreadId', + flow_id: 'flowId', + flow_node_id: 'knowledgebaseNodeId', bot_interaction_id: 'testInteractionId', type: EventType.BotEvent, }) diff --git a/packages/botonic-react/CHANGELOG.md b/packages/botonic-react/CHANGELOG.md index 08bf05d3ff..85bf7a324e 100644 --- a/packages/botonic-react/CHANGELOG.md +++ b/packages/botonic-react/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to Botonic will be documented in this file.
- Changes that have landed in master but are not yet released. + Changes that have landed in master-lts but are not yet released. Click to see more.