From 73294b19b4b4db5eb7fa6e29c7ade73bf04b89d6 Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Tue, 27 May 2025 18:24:39 -0500 Subject: [PATCH] Refactored to flow Hub Packaging directory structures --- .gitignore | 2 +- CA_INAPI/README.md | 50 ++++++ ..._e8063074-0129-41df-9a40-2f5386b0b3d5.json | 0 .../GlobalVariable}/INAPI.js | 0 .../Conversation Flows/endSpan.js | 17 -- .../Conversation Flows/startSpan.js | 20 --- README.md | 157 +++--------------- basic-messenger-cli/README.md | 86 ++++++++++ .../ProxyScript}/basic_messenger.js | 0 .../application}/.env | 0 .../application}/README.md | 0 .../application}/package-lock.json | 3 - .../application}/package.json | 0 .../application}/src/client/client.js | 0 .../application}/src/index.js | 0 open-telemetry/README.md | 52 ++++++ .../GlobalVariable}/latencySpan.js | 0 .../GlobalVariable}/opentelemetry.js | 0 .../opentelemetry_settings.json | 0 .../ProxyScript}/latency_span.js | 0 salesforce-mock/README.md | 1 + .../ProxyScript}/salesforce_mock.js | 0 .../README.md | 8 + .../GlobalVariable}/webdis.js | 0 24 files changed, 222 insertions(+), 174 deletions(-) create mode 100644 CA_INAPI/README.md rename {Exports => CA_INAPI/_studio_dependencies/ConversationFlowExport}/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json (100%) rename {Integrations/Global Variables => CA_INAPI/_studio_dependencies/GlobalVariable}/INAPI.js (100%) delete mode 100644 Conversation Design/Conversation Flows/endSpan.js delete mode 100644 Conversation Design/Conversation Flows/startSpan.js create mode 100644 basic-messenger-cli/README.md rename {Integrations/Proxy Scripts => basic-messenger-cli/_studio_dependencies/ProxyScript}/basic_messenger.js (100%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/.env (100%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/README.md (100%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/package-lock.json (99%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/package.json (100%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/src/client/client.js (100%) rename {Applications/basic-messenger-cli => basic-messenger-cli/application}/src/index.js (100%) create mode 100644 open-telemetry/README.md rename {Integrations/Global Variables => open-telemetry/_studio_dependencies/GlobalVariable}/latencySpan.js (100%) rename {Integrations/Global Variables => open-telemetry/_studio_dependencies/GlobalVariable}/opentelemetry.js (100%) rename {Integrations/Global Variables => open-telemetry/_studio_dependencies/GlobalVariable}/opentelemetry_settings.json (100%) rename {Integrations/Proxy Scripts => open-telemetry/_studio_dependencies/ProxyScript}/latency_span.js (100%) create mode 100644 salesforce-mock/README.md rename {Integrations/Proxy Scripts => salesforce-mock/_studio_dependencies/ProxyScript}/salesforce_mock.js (100%) rename Conversation Design/Conversation Flows/publishToTestHarness.js => test-harness/README.md (77%) rename {Integrations/Global Variables => test-harness/_studio_dependencies/GlobalVariable}/webdis.js (100%) diff --git a/.gitignore b/.gitignore index 4d193ad..4eae417 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -Applications/basic-messenger-cli/node_modules +basic-messenger-cli/application/node_modules \ No newline at end of file diff --git a/CA_INAPI/README.md b/CA_INAPI/README.md new file mode 100644 index 0000000..05c3546 --- /dev/null +++ b/CA_INAPI/README.md @@ -0,0 +1,50 @@ +# Interaction Notification API + +Interaction Notification API is used to push Call Pops into Channel Automation. + +## Prerequisits + +1. Install and configure the _Channel Automation Interface_ Package from Resource Center -> Hub. +2. Download then Import into you IVA Workspace [INAPI Package](_studio_dependencies/ConversationFlowExport/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json) +3. Follow instructions for [Configuring Telephony Call Data Fields](https://em-docs.verint.com/15_3/em-channels/Content/Telephony/Configuring_Telephony_Call_Data_Fields.htm) in Channel Automation +4. Follow instructions for [Configure Call Information Views](https://em-docs.verint.com/15_3/em-channels/Content/Configuring_the_Transfer_Bot__Voice_.htm) + +## Source Code + +[INAPI](./_studio_dependencies/Global%20Variable/INAPI.js) Global Variable Function + +## Example Usage + +Conversation Flow Code Block that calls the API with some data and user name 'ccmary' + +```javascript +(async () => { + const ani = recognizedObject.metadata.ani; + const dnis = recognizedObject.metadata.dnis; + const firstName = conversationData.customer?.firstName ?? "FirstName"; + const lastName = conversationData.customer?.lastName ?? "LastName"; + const studentId = conversationData.customer?.studentId ?? "StudentId"; + const dob = conversationData.customer?.dob ?? "1/1/1970"; + INAPI().post(`${ani}`, `${dnis}`, "ccmary", { + "@type": "ved:TelephonyCallDataED", + "ved:firstName": `${firstName}`, + "ved:lastName": `${lastName}`, + "ved:studentId": `${studentId}`, + "ved:dob": `${dob}`, + }); +})() + .catch((error) => { + console.log(error.message); + recognizedObject.answers.push(""); + recognizedObject.errorInfo = { + ...recognizedObject.errorInfo, + label: { + data: error.toJSON ? error.toJSON() : {}, + message: error.message, + }, + }; + }) + .finally(() => { + next(); + }); +``` \ No newline at end of file diff --git a/Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json b/CA_INAPI/_studio_dependencies/ConversationFlowExport/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json similarity index 100% rename from Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json rename to CA_INAPI/_studio_dependencies/ConversationFlowExport/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json diff --git a/Integrations/Global Variables/INAPI.js b/CA_INAPI/_studio_dependencies/GlobalVariable/INAPI.js similarity index 100% rename from Integrations/Global Variables/INAPI.js rename to CA_INAPI/_studio_dependencies/GlobalVariable/INAPI.js diff --git a/Conversation Design/Conversation Flows/endSpan.js b/Conversation Design/Conversation Flows/endSpan.js deleted file mode 100644 index a9ea549..0000000 --- a/Conversation Design/Conversation Flows/endSpan.js +++ /dev/null @@ -1,17 +0,0 @@ -(async () => { - await opentelemetry().endSpan(); -})() - .catch((error) => { - console.log(error.message); - recognizedObject.answers.push(""); - recognizedObject.errorInfo = { - ...recognizedObject.errorInfo, - label: { - data: error.toJSON ? error.toJSON() : {}, - message: error.message, - }, - }; - }) - .finally(() => { - next(); - }); diff --git a/Conversation Design/Conversation Flows/startSpan.js b/Conversation Design/Conversation Flows/startSpan.js deleted file mode 100644 index 0d228b0..0000000 --- a/Conversation Design/Conversation Flows/startSpan.js +++ /dev/null @@ -1,20 +0,0 @@ -(async () => { - await latencySpan().endSpan(recognizedObject.conversationId); - - const span = await opentelemetry().startSpan("Global Flow"); - console.log(span); -})() - .catch((error) => { - console.log(error.message); - recognizedObject.answers.push(""); - recognizedObject.errorInfo = { - ...recognizedObject.errorInfo, - label: { - data: error.toJSON ? error.toJSON() : {}, - message: error.message, - }, - }; - }) - .finally(() => { - next(); - }); diff --git a/README.md b/README.md index 70afcc7..d05331c 100644 --- a/README.md +++ b/README.md @@ -2,142 +2,33 @@ Place to put random files and examples used in IVA Workspaces -## Channel Automation +Each example follows the following directory structure taken from the IVAS Hub Packaging guidelines: -### Interaction Notification API +## Hub Package -Interaction Notification API is used to push Call Pops into Channel Automation. +Hub Package is configured through a few locations. Utilize the structure +below to understand the relationship and purpose of the different +files and locations. -#### Prerequisits +File content will have instances of {{ Hub Version }} replaced with the +identified version based on git Tag. -1. Install and configure the _Channel Automation Interface_ Package from Resource Center -> Hub. -2. Download then Import into you IVA Workspace [INAPI Package](./Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json) -3. Follow instructions for [Configuring Telephony Call Data Fields](https://em-docs.verint.com/15_3/em-channels/Content/Telephony/Configuring_Telephony_Call_Data_Fields.htm) in Channel Automation -4. Follow instructions for [Configure Call Information Views](https://em-docs.verint.com/15_3/em-channels/Content/Configuring_the_Transfer_Bot__Voice_.htm) - -#### Source Code - -[INAPI](./Integrations/Global%20Variables/INAPI.js) Global Variable Function - -#### Example Usage - -Conversation Flow Code Block that calls the API with some data and user name 'ccmary' - -```javascript -(async () => { - const ani = recognizedObject.metadata.ani; - const dnis = recognizedObject.metadata.dnis; - const firstName = conversationData.customer?.firstName ?? "FirstName"; - const lastName = conversationData.customer?.lastName ?? "LastName"; - const studentId = conversationData.customer?.studentId ?? "StudentId"; - const dob = conversationData.customer?.dob ?? "1/1/1970"; - INAPI().post(`${ani}`, `${dnis}`, "ccmary", { - "@type": "ved:TelephonyCallDataED", - "ved:firstName": `${firstName}`, - "ved:lastName": `${lastName}`, - "ved:studentId": `${studentId}`, - "ved:dob": `${dob}`, - }); -})() - .catch((error) => { - console.log(error.message); - recognizedObject.answers.push(""); - recognizedObject.errorInfo = { - ...recognizedObject.errorInfo, - label: { - data: error.toJSON ? error.toJSON() : {}, - message: error.message, - }, - }; - }) - .finally(() => { - next(); - }); ``` - -## Basic Messenger - -Built for PoCs with other Speech Services, this provides a simple text from a prompt interface for IVA Studio - -### Prerequisits - -1. Install and configure the _Core Messenger Webhook_ Package from the Resource Center -> Hub. - -### Source Code - -[basic_messenger](./Integrations/Proxy%20Scripts/basic_messenger.js) Proxy Script - -### Example usage - -```sh -curl --location 'https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/basic_messenger' \ ---header 'Content-Type: application/json' \ ---data '{ - "input" : "What is the weather", - "model" : "main" -}' +/ +├───\_studio\_dependencies/ +│ ├───ConversationFlowExport/ -- Export of example conversation flows +│ ├───DynamicQuery/ +│ ├───Engagement/ +│ ├───GlobalVariable/ +│ ├───ProxyScript/ +│ ├───README.md -- Hub Readme Document +│ └───HubPackage.json -- Hub Name/Description and Official Verint Package +└───widget/ + ├───README.md -- General Development documentation + ├───{widgetName}/ + │ ├───\_studio\_dependencies/ + │ │ └───README.md -- Widget Readme Document + │ ├───widget.config.json -- Widget Name and Description + │ └───README.md -- Development Notes for specific widget + └───{widgetName2}/ ``` - -```json -{ - "id": "resp_c8191807-c478-41d0-a73c-68d361eae5a3", - "object": "response", - "created_at": 1745609535, - "status": "completed", - "model": "main", - "output": [ - { - "type": "message", - "id": "msg_56594e02-ae08-47ce-8c7f-d5165b1fa9de", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "Could you please provide a city or a zip code to get the weather information?", - "annotations": [] - } - ] - } - ] -} -``` - -Note the use of "previous_response_id" to manage conversation state. - -```sh -curl --location 'https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/basic_messenger' \ ---header 'Content-Type: application/json' \ ---data '{ - "input" : "Chicago", - "model" : "main", - "previous_response_id" : "resp_c8191807-c478-41d0-a73c-68d361eae5a3" -}' -``` - -```json -{ - "id": "resp_c8191807-c478-41d0-a73c-68d361eae5a3", - "object": "response", - "created_at": 1745609627, - "status": "completed", - "model": "main", - "output": [ - { - "type": "message", - "id": "msg_ef591b4c-b08b-49fe-85a5-306c94269bf6", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "Can you provide the zip code for Chicago?", - "annotations": [] - } - ] - } - ] -} -``` - -#### CLI client for basic_messenger - -You can find an example CLI client (using Node.js) [here](./Applications/basic-messenger-cli/) diff --git a/basic-messenger-cli/README.md b/basic-messenger-cli/README.md new file mode 100644 index 0000000..a475dae --- /dev/null +++ b/basic-messenger-cli/README.md @@ -0,0 +1,86 @@ +# Basic Messenger + +Built for PoCs with other Speech Services, this provides a simple text from a prompt interface for IVA Studio + +## Prerequisits + +1. Install and configure the _Core Messenger Webhook_ Package from the Resource Center -> Hub. + +## Source Code + +[basic_messenger](./_studio_dependencies/ProxyScript/basic_messenger.js) Proxy Script + +## Example usage + +```sh +curl --location 'https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/basic_messenger' \ +--header 'Content-Type: application/json' \ +--data '{ + "input" : "What is the weather", + "model" : "main" +}' +``` + +```json +{ + "id": "resp_c8191807-c478-41d0-a73c-68d361eae5a3", + "object": "response", + "created_at": 1745609535, + "status": "completed", + "model": "main", + "output": [ + { + "type": "message", + "id": "msg_56594e02-ae08-47ce-8c7f-d5165b1fa9de", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Could you please provide a city or a zip code to get the weather information?", + "annotations": [] + } + ] + } + ] +} +``` + +Note the use of "previous_response_id" to manage conversation state. + +```sh +curl --location 'https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/basic_messenger' \ +--header 'Content-Type: application/json' \ +--data '{ + "input" : "Chicago", + "model" : "main", + "previous_response_id" : "resp_c8191807-c478-41d0-a73c-68d361eae5a3" +}' +``` + +```json +{ + "id": "resp_c8191807-c478-41d0-a73c-68d361eae5a3", + "object": "response", + "created_at": 1745609627, + "status": "completed", + "model": "main", + "output": [ + { + "type": "message", + "id": "msg_ef591b4c-b08b-49fe-85a5-306c94269bf6", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Can you provide the zip code for Chicago?", + "annotations": [] + } + ] + } + ] +} +``` + +#### CLI client for basic_messenger + +You can find an example CLI client (using Node.js) [here](./application/) diff --git a/Integrations/Proxy Scripts/basic_messenger.js b/basic-messenger-cli/_studio_dependencies/ProxyScript/basic_messenger.js similarity index 100% rename from Integrations/Proxy Scripts/basic_messenger.js rename to basic-messenger-cli/_studio_dependencies/ProxyScript/basic_messenger.js diff --git a/Applications/basic-messenger-cli/.env b/basic-messenger-cli/application/.env similarity index 100% rename from Applications/basic-messenger-cli/.env rename to basic-messenger-cli/application/.env diff --git a/Applications/basic-messenger-cli/README.md b/basic-messenger-cli/application/README.md similarity index 100% rename from Applications/basic-messenger-cli/README.md rename to basic-messenger-cli/application/README.md diff --git a/Applications/basic-messenger-cli/package-lock.json b/basic-messenger-cli/application/package-lock.json similarity index 99% rename from Applications/basic-messenger-cli/package-lock.json rename to basic-messenger-cli/application/package-lock.json index fc69975..b608beb 100644 --- a/Applications/basic-messenger-cli/package-lock.json +++ b/basic-messenger-cli/application/package-lock.json @@ -11,9 +11,6 @@ "dependencies": { "axios": "^1.9.0", "dotenv": "^16.5.0" - }, - "bin": { - "hello": "bin/index.js" } }, "node_modules/asynckit": { diff --git a/Applications/basic-messenger-cli/package.json b/basic-messenger-cli/application/package.json similarity index 100% rename from Applications/basic-messenger-cli/package.json rename to basic-messenger-cli/application/package.json diff --git a/Applications/basic-messenger-cli/src/client/client.js b/basic-messenger-cli/application/src/client/client.js similarity index 100% rename from Applications/basic-messenger-cli/src/client/client.js rename to basic-messenger-cli/application/src/client/client.js diff --git a/Applications/basic-messenger-cli/src/index.js b/basic-messenger-cli/application/src/index.js similarity index 100% rename from Applications/basic-messenger-cli/src/index.js rename to basic-messenger-cli/application/src/index.js diff --git a/open-telemetry/README.md b/open-telemetry/README.md new file mode 100644 index 0000000..a7209b9 --- /dev/null +++ b/open-telemetry/README.md @@ -0,0 +1,52 @@ +# Open Telemetery Example + +## Example Usage + +Use the _code block_ widget to start and end spans. Spans can be nested to form a stack, ending a span will always end the last span added to the stack. + +### Start Span + +```javascript +(async () => { + await latencySpan().endSpan(recognizedObject.conversationId); + + const span = await opentelemetry().startSpan("Global Flow"); + console.log(span); +})() + .catch((error) => { + console.log(error.message); + recognizedObject.answers.push(""); + recognizedObject.errorInfo = { + ...recognizedObject.errorInfo, + label: { + data: error.toJSON ? error.toJSON() : {}, + message: error.message, + }, + }; + }) + .finally(() => { + next(); + }); +``` + +### End Span + +```javascript +(async () => { + await opentelemetry().endSpan(); +})() + .catch((error) => { + console.log(error.message); + recognizedObject.answers.push(""); + recognizedObject.errorInfo = { + ...recognizedObject.errorInfo, + label: { + data: error.toJSON ? error.toJSON() : {}, + message: error.message, + }, + }; + }) + .finally(() => { + next(); + }); +``` \ No newline at end of file diff --git a/Integrations/Global Variables/latencySpan.js b/open-telemetry/_studio_dependencies/GlobalVariable/latencySpan.js similarity index 100% rename from Integrations/Global Variables/latencySpan.js rename to open-telemetry/_studio_dependencies/GlobalVariable/latencySpan.js diff --git a/Integrations/Global Variables/opentelemetry.js b/open-telemetry/_studio_dependencies/GlobalVariable/opentelemetry.js similarity index 100% rename from Integrations/Global Variables/opentelemetry.js rename to open-telemetry/_studio_dependencies/GlobalVariable/opentelemetry.js diff --git a/Integrations/Global Variables/opentelemetry_settings.json b/open-telemetry/_studio_dependencies/GlobalVariable/opentelemetry_settings.json similarity index 100% rename from Integrations/Global Variables/opentelemetry_settings.json rename to open-telemetry/_studio_dependencies/GlobalVariable/opentelemetry_settings.json diff --git a/Integrations/Proxy Scripts/latency_span.js b/open-telemetry/_studio_dependencies/ProxyScript/latency_span.js similarity index 100% rename from Integrations/Proxy Scripts/latency_span.js rename to open-telemetry/_studio_dependencies/ProxyScript/latency_span.js diff --git a/salesforce-mock/README.md b/salesforce-mock/README.md new file mode 100644 index 0000000..a46666c --- /dev/null +++ b/salesforce-mock/README.md @@ -0,0 +1 @@ +# Salesforce Mock Proxy diff --git a/Integrations/Proxy Scripts/salesforce_mock.js b/salesforce-mock/_studio_dependencies/ProxyScript/salesforce_mock.js similarity index 100% rename from Integrations/Proxy Scripts/salesforce_mock.js rename to salesforce-mock/_studio_dependencies/ProxyScript/salesforce_mock.js diff --git a/Conversation Design/Conversation Flows/publishToTestHarness.js b/test-harness/README.md similarity index 77% rename from Conversation Design/Conversation Flows/publishToTestHarness.js rename to test-harness/README.md index 42f1771..415aa59 100644 --- a/Conversation Design/Conversation Flows/publishToTestHarness.js +++ b/test-harness/README.md @@ -1,3 +1,10 @@ +# Test Harness Support files + +The test harness uses Redis event pub/sub to receive notifications from IVA Studio. + +## Example Usage + +```javascript (async () => { webdis().publish(recognizedObject.workspaceId, { conversationId: recognizedObject.conversationId, @@ -19,3 +26,4 @@ .finally(() => { next(); }); +``` \ No newline at end of file diff --git a/Integrations/Global Variables/webdis.js b/test-harness/_studio_dependencies/GlobalVariable/webdis.js similarity index 100% rename from Integrations/Global Variables/webdis.js rename to test-harness/_studio_dependencies/GlobalVariable/webdis.js