112 lines
4.1 KiB
Markdown
112 lines
4.1 KiB
Markdown
# ca_iva_email_automation
|
|
|
|
Integration example between Channel Automation and IVA to automatically replying to email
|
|
|
|
## Workflow between Channel Automation and IVA
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
actor Customer
|
|
participant MailServer
|
|
box rgb(254,150,0) Channel Automation
|
|
participant RulesEngine
|
|
participant CaseMgt
|
|
participant CustomerProfile
|
|
end
|
|
participant IVA
|
|
Customer->>MailServer: Send Email
|
|
MailServer->>RulesEngine: Inbound Email
|
|
RulesEngine->>CaseMgt: CreateCaseFromEmail(SmartRule)
|
|
CaseMgt->>+IVA: Email NotificationWebHook
|
|
IVA->>CaseMgt: caseAction(Acknowledge)
|
|
IVA->>CaseMgt: getCase(caseId)
|
|
IVA-->>IVA: Model Inference using Body
|
|
IVA->>CustomerProfile: search(emailAddress)
|
|
CustomerProfile->>IVA: Customer Details
|
|
IVA->>-CaseMgt: createCase(IVAReplyEmail) with answer
|
|
CaseMgt->>MailServer: sendReply using Template
|
|
MailServer->>Customer: reply email
|
|
```
|
|
|
|
## IVA Proxy Scripts
|
|
|
|
There are 2 scripts required:
|
|
|
|
1. A proxy script for handling the Email Notification.
|
|
1. A Global Variable function to handle Case Management and Customer Profile API calls.
|
|
|
|
## Channel Automation Setup
|
|
|
|
### Case Management
|
|
|
|
| Case Name | API @type | States | Actions |
|
|
| - | - | - | - |
|
|
| Notify IVA of Email | vcs:Intentbasedautomation | Send to IVA | 'On Entry' 'Send to IVA' using 'Call API Action'<br>'Ad-hoc' 'IVA Accepted' using 'UpdateAssociatedEntitiesAction' with Transition to 'IVA Accepted' State |
|
|
| Notify IVA of Email | vcs:Intentbasedautomation | IVA Accepted | |
|
|
| IVA Email Auto Reply | vcs:IVAEmailAutoReply | Send Email | 'On Entry' 'Send Email Action' to send the email using the template below and set Success and Failure transition states |
|
|
| IVA Email Auto Reply | vcs:IVAEmailAutoReply | Email Sent | |
|
|
| IVA Email Auto Reply | vcs:IVAEmailAutoReply | Email Failed | |
|
|
| IVA Email Auto Reply | vcs:IVAEmailAutoReply | Email Cancelled | |
|
|
|
|
### Dynamic Entities
|
|
|
|
> Remember to create Views for fields that you would like the APIs to return
|
|
|
|
| System Name | Fields |
|
|
| - | - |
|
|
| InboundEmail | subject<br>body |
|
|
| EmailResponse | body<br> conversationId |
|
|
|
|
### Web Integration URLs
|
|
|
|
> Hosts and Paths will depend on IVA Studio Workspace
|
|
|
|
| Purpose | Host | Display Name | Path | Authorization |
|
|
| - | - | - | - | - |
|
|
| Action | IVA Studio - `https://router.ivastudio.verint.live/` | Email Case to IVA | ProxyScript/run/661554664677144c0e1e71d5/current/emailToCaseInference | Manual |
|
|
|
|
#### Body
|
|
|
|
```json
|
|
{
|
|
"subject": "[[::-FrameworkBaseCaseED.caseSummary-::]]",
|
|
"caseId": [[::-FrameworkBaseCaseED.id.id-::]],
|
|
"createdBy": "[[::-FrameworkBaseCaseED.createdBy-::]]",
|
|
"modelName": "email",
|
|
"settings":
|
|
{
|
|
"intentConfidenceThreshold": 0.4
|
|
}
|
|
}
|
|
```
|
|
|
|
### Templates
|
|
|
|
Example Email Template:
|
|
|
|
```text
|
|
THIS IS AN AUTOMATED EMAIL RESPONSE
|
|
|
|
[[::-EmailResponse.body-::]]
|
|
|
|
|
|
|
|
Original Email
|
|
|
|
Subject: [[::-InboundEmail.subject-::]]
|
|
|
|
|
|
|
|
[[::-InboundEmail.body-::]]
|
|
|
|
|
|
|
|
Conversation ID: [[::-EmailResponse.conversationId-::]]
|
|
```
|
|
|
|
## Known Limitations that led to this design pattern
|
|
|
|
1. getCase API does not have a way to get access to the Contact History and hence original email. Therefore we have to rely on the Case Notes from the 'Create case from email' Rules Action to extract the body. This limits the body to the Notes limit of 1000 characters.
|
|
2. 'Create case from email' does not associate the Customer record with the Case instance. Case's sendEmail action requires a Customer to be associated with the Case. Therefore, we delegate the ReplyCase creation to the IVA proxy script because it can pass in the customer reference and reply content for the template to the createCase API.
|
|
3. IVA Studio only accepts 'application/json' Content-Type. And I considered using the Run External URL directly from the RulesEngine to the IVA Proxy. However, there is no preprocessing of Placeholder expanded text when populating an WebIntegration URL and the body of the email is typically multi-line causing a validation error on sending. Using a case instead to pass the body does allow us to using States to Acknowledge the noticiation.
|