Adding INAPI example
This commit is contained in:
55
README.md
55
README.md
@@ -1,3 +1,54 @@
|
||||
# iva-studio-workspace
|
||||
# IVA Studio Workspace
|
||||
|
||||
Place to put random IVA Studio Workspace files and examples
|
||||
Place to put random files and examples used in IVA Workspaces
|
||||
|
||||
## Channel Automation
|
||||
|
||||
### 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. Import [Package](./Exports/IVA-Solution-Consultants_Peter's-Workspace_INAPI_e8063074-0129-41df-9a40-2f5386b0b3d5.json)
|
||||
|
||||
#### 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();
|
||||
});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user