Adding basic_messenger for PoCs with other Speech Services
This commit is contained in:
parent
40487089c7
commit
a2ce640132
139
README.md
139
README.md
@ -10,7 +10,7 @@ Interaction Notification API is used to push Call Pops into Channel Automation.
|
|||||||
|
|
||||||
#### Prerequisits
|
#### Prerequisits
|
||||||
|
|
||||||
1. Install and configure the *Channel Automation Interface* Package from Resource Center -> Hub.
|
1. Install and configure the _Channel Automation Interface_ Package from Resource Center -> Hub.
|
||||||
2. Download then Import [INAPI Package](./Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json)
|
2. Download then Import [INAPI Package](./Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json)
|
||||||
|
|
||||||
#### Source Code
|
#### Source Code
|
||||||
@ -23,32 +23,115 @@ Conversation Flow Code Block that calls the API with some data and user name 'cc
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
(async () => {
|
(async () => {
|
||||||
const ani = recognizedObject.metadata.ani;
|
const ani = recognizedObject.metadata.ani;
|
||||||
const dnis = recognizedObject.metadata.dnis;
|
const dnis = recognizedObject.metadata.dnis;
|
||||||
const firstName = conversationData.customer?.firstName ?? "FirstName";
|
const firstName = conversationData.customer?.firstName ?? "FirstName";
|
||||||
const lastName = conversationData.customer?.lastName ?? "LastName";
|
const lastName = conversationData.customer?.lastName ?? "LastName";
|
||||||
const studentId = conversationData.customer?.studentId ?? "StudentId";
|
const studentId = conversationData.customer?.studentId ?? "StudentId";
|
||||||
const dob = conversationData.customer?.dob ?? "1/1/1970";
|
const dob = conversationData.customer?.dob ?? "1/1/1970";
|
||||||
INAPI().post(`${ani}`, `${dnis}`, "ccmary", {
|
INAPI().post(`${ani}`, `${dnis}`, "ccmary", {
|
||||||
"@type": "ved:TelephonyCallDataED",
|
"@type": "ved:TelephonyCallDataED",
|
||||||
"ved:firstName": `${firstName}`,
|
"ved:firstName": `${firstName}`,
|
||||||
"ved:lastName": `${lastName}`,
|
"ved:lastName": `${lastName}`,
|
||||||
"ved:studentId": `${studentId}`,
|
"ved:studentId": `${studentId}`,
|
||||||
"ved:dob": `${dob}`,
|
"ved:dob": `${dob}`,
|
||||||
});
|
});
|
||||||
})()
|
})()
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
recognizedObject.answers.push("");
|
recognizedObject.answers.push("");
|
||||||
recognizedObject.errorInfo = {
|
recognizedObject.errorInfo = {
|
||||||
...recognizedObject.errorInfo,
|
...recognizedObject.errorInfo,
|
||||||
label: {
|
label: {
|
||||||
data: error.toJSON ? error.toJSON() : {},
|
data: error.toJSON ? error.toJSON() : {},
|
||||||
message: error.message,
|
message: error.message,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
next();
|
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"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
```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": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user