This project includes everything you need to deliver Email-To-Flow functionality for Salesforce. This functionality makes it easy to build email response automation with no code in a Salesforce org.
In the source provided, Apex will first recieve an incoming email, convert that email into an Apex Object, and then determine all of the intent, sentiment, and NER using Einstein Platform Services before kick-starting a Flow with the email and Einstein insight in tow.
This allows admins to manage logic around inbound emails. For this specific example, an admin wanted to send an auto-reply email with order information when a customer asks about order status.
Create_Case
- Boolean - defaults to true. If you do not want a case created from the email, set this to false. There is some apex written (EmailToCaseUtility
) to save binary attachments and email information to the case that is created.New_Case
- Case - fields filled out in this Case record will be used to create a case inEmailToCaseUtility
Received_Email
- EmailBotObject - holds all of the email information (from address, to addresses, text body, subject... etc) as well as results from Einstein Intent and Sentiment.
When you create a new instance of the custom metadata, the code is looking for one called "Email Bot".
Case Origin
- When case is created, this value will populate to the Case Origin field.Case Status
- When case is created, this value will be populated to the Case Status field.Intent Model ID
- ID for Einstein Intent model.NER Model ID
- Entity Recognition isn't included in this version, but the infrastructure is there. This defaults toNER7
.Sentiment Model ID
- ID for Einstein Sentiment model. This defaults to theCommunitySentiment
model. Support Queue ID
Install has dependency on these Managed Packages
- Unofficial SF - Flow Base Components
- Unofficial SF - Send Better Email Flow Action
- Einstein Playground App
Installation
- Install the Unofficial SF - Flow Base Components and Unofficial SF - Send Better Email Flow Action unmanaged packages. This will give the bot the ability to send emails using email templates from a Flow. While installing both of these unmanaged packages, there's an advanced settings tab in the package installation prompt for each one, make sure you select "Compile Only Apex in the Package".
- Install Einstein Playground App
- Install code and configuration from this GitHub repo using DX or this install button
- Intent: build an intent model or use one that already exists in your org. Add Model ID to Custom Metadata, add the model ID to the
Email Bot Setting
custom metadata. - Sentiment: build a sentiment model, use one that already exists in your org, or use the
CommunitySentiment
model. Add the model ID to theEmail Bot Setting
custom metadata. - Entity Recognition: for testing purposes I used
NER7
. - For testing, create a custom email service that uses the inbound email handler.
- Ship it โ๏ธ