Refactored to flow Hub Packaging directory structures
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"file":{"content":{"intents":[],"alternates":[],"entities":[],"entityValues":[],"conversationFlows":[],"globalVariables":[{"_id":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjgwMTdiMDhkODY5NzFiMzIzMGY1MzVl","workspaceId":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjdiY2E4NjIyMTAwNzE2MjdkMzJlZjEy","name":"INAPI","type":"Function","content":"return {\n post(ani, dnis, agent, userData) {\n return new Promise(async (resolve, reject) => {\n try {\n const OIDC = await CAInterface().getOIDC();\n let config = CAInterface().settings().url.CA;\n const inapiURL = `https://${config.base}/interaction-notifier/${config.tenant}/notifications`;\n\n const { data } = await CAInterface().axios(\"inapi\", {\n method: \"post\",\n url: inapiURL,\n headers: {\n \"Content-Type\": \"application/ld+json\",\n Authorization: `OIDC_id_token ${OIDC.access_token}`,\n },\n data: {\n \"@type\": \"vin:InteractionNotification\",\n \"vin:target\": {\n \"@type\": \"vemorg:Agent\",\n \"so:identifier\": agent,\n },\n \"vin:interaction\": {\n \"@type\": \"vin:InboundTelephonyInteraction\",\n \"vin:dnis\": dnis,\n \"vin:cli\": ani,\n \"vin:userData\": userData,\n },\n },\n });\n console.log({\n inapiresult: data,\n });\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n },\n};","parameters":"","returnsContextObject":false,"organizationId":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjRjMmJhMGQ5NDdkMGM3OWY0YjlkN2Ey","metadata":{"createdBy":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjRiYWMwNTkyNGE5YzU3ODNlZjc0MjRl","createdAt":1744924338236,"_vc":{"branch":"current","operation":"update","_id":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjgwMTZlYjJkODY5NzFiMzIzMGY1MzU1","lts_id":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjgwMTdiNzk4YzllYjA3MzRjMjcyNzQ1","commitId":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjgwMTdiNzlkODY5NzFiMzIzMGY1MzVm"},"updatedBy":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjRiYWMwNTkyNGE5YzU3ODNlZjc0MjRl","updatedAt":1744927609557}}],"proxyScripts":[],"dynamicQueries":[],"widgets":[]},"authorId":"4d5df90a-66f1-48b1-9762-7d76c888d153-NjRiYWMwNTkyNGE5YzU3ODNlZjc0MjRl","description":"Interaction Notification API is used to push Call Pops into Channel Automation.","readme":"### Interaction Notification API\n\nInteraction Notification API is used to push Call Pops into Channel Automation.\n\n#### Prerequisits\n\nInstall the Channel Automation Hub Package\n\nConversation Flow Code Block Example:\n\n```javascript\n(async () => {\n const ani = recognizedObject.metadata.ani;\n const dnis = recognizedObject.metadata.dnis;\n const firstName = conversationData.customer?.firstName ?? \"FirstName\";\n const lastName = conversationData.customer?.lastName ?? \"LastName\";\n const studentId = conversationData.customer?.studentId ?? \"StudentId\";\n const dob = conversationData.customer?.dob ?? \"1/1/1970\";\n INAPI().post(`${ani}`, `${dnis}`, \"ccmary\", {\n \"@type\": \"ved:TelephonyCallDataED\",\n \"ved:firstName\": `${firstName}`,\n \"ved:lastName\": `${lastName}`,\n \"ved:studentId\": `${studentId}`,\n \"ved:dob\": `${dob}`,\n });\n})()\n .catch((error) => {\n console.log(error.message);\n recognizedObject.answers.push(\"\");\n recognizedObject.errorInfo = {\n ...recognizedObject.errorInfo,\n label: {\n data: error.toJSON ? error.toJSON() : {},\n message: error.message,\n },\n };\n })\n .finally(() => {\n next();\n });\n```","entities":{"Widget":[],"Dashboard":[],"DynamicQuery":[],"GlobalVariable":["4d5df90a-66f1-48b1-9762-7d76c888d153-NjgwMTdiMDhkODY5NzFiMzIzMGY1MzVl"],"ProxyScript":[],"Alternate":[],"ConversationFlow":[],"EntityValue":[],"Entity":[],"Intent":[]},"name":"INAPI","status":"PENDING","version":{"major":0,"minor":0,"patch":1}},"id":"b30f87430eafcaf7db50128a3c815e4f"}
|
||||
39
CA_INAPI/_studio_dependencies/GlobalVariable/INAPI.js
Normal file
39
CA_INAPI/_studio_dependencies/GlobalVariable/INAPI.js
Normal file
@@ -0,0 +1,39 @@
|
||||
return {
|
||||
post(ani, dnis, agent, userData) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const OIDC = await CAInterface().getOIDC()
|
||||
let config = CAInterface().settings().url.CA
|
||||
const inapiURL = `https://${config.base}/interaction-notifier/${config.tenant}/notifications`
|
||||
|
||||
const { data } = await CAInterface().axios('inapi', {
|
||||
method: 'post',
|
||||
url: inapiURL,
|
||||
headers: {
|
||||
'Content-Type': 'application/ld+json',
|
||||
Authorization: `OIDC_id_token ${OIDC.access_token}`,
|
||||
},
|
||||
data: {
|
||||
'@type': 'vin:InteractionNotification',
|
||||
'vin:target': {
|
||||
'@type': 'vemorg:Agent',
|
||||
'so:identifier': agent,
|
||||
},
|
||||
'vin:interaction': {
|
||||
'@type': 'vin:InboundTelephonyInteraction',
|
||||
'vin:dnis': dnis,
|
||||
'vin:cli': ani,
|
||||
'vin:userData': userData,
|
||||
},
|
||||
},
|
||||
})
|
||||
console.log({
|
||||
inapiresult: data,
|
||||
})
|
||||
resolve()
|
||||
} catch (error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user