Book Image

Architecting AI Solutions on Salesforce

By : Lars Malmqvist
Book Image

Architecting AI Solutions on Salesforce

By: Lars Malmqvist

Overview of this book

Written for Salesforce architects who want quickly implementable AI solutions for their business challenges, Architecting AI Solutions on Salesforce is a shortcut to understanding Salesforce Einstein’s full capabilities – and using them. To illustrate the full technical benefits of Salesforce’s own AI solutions and components, this book will take you through a case study of a fictional company beginning to adopt AI in its Salesforce ecosystem. As you progress, you'll learn how to configure and extend the out-of-the-box features on various Salesforce clouds, their pros, cons, and limitations. You'll also discover how to extend these features using on- and off-platform choices and how to make the best architectural choices when designing custom solutions. Later, you'll advance to integrating third-party AI services such as the Google Translation API, Microsoft Cognitive Services, and Amazon SageMaker on top of your existing solutions. This isn’t a beginners’ Salesforce book, but a comprehensive overview with practical examples that will also take you through key architectural decisions and trade-offs that may impact the design choices you make. By the end of this book, you'll be able to use Salesforce to design powerful tailor-made solutions for your customers with confidence.
Table of Contents (17 chapters)
1
Section 1: Salesforce and AI
3
Section 2: Out-of-the-Box AI Features for Salesforce
8
Section 3: Extending and Building AI Features
12
Section 4: Making the Right Decision

What are the elements of Salesforce Einstein?

This section will serve as a crash course in the various elements of the Einstein platform. It also serves as a handy reference for the content that will be coming in future chapters. All the features shown in the following diagram will be elaborated on further on in the book.

The chapters are standalone, so if anything catches your fancy, feel free to skip ahead to that section. I do, however, recommend that you take the time to finish this introductory chapter, as it sets the scene for the rest of the book.

Figure 1.2 – An overview of Einstein elements

Figure 1.2 – An overview of Einstein elements

We will start by considering the components of the Einstein platform related to sales.

Einstein for sales

Sales are the first use case that springs to mind when you think of Salesforce. It is, therefore, not surprising that this is an area with a strong AI offering as well. The following sections will introduce you to the various elements in play.

Einstein Lead and Opportunity Scoring

With Einstein Lead and Opportunity Scoring, you get an out-of-the-box way to apply AI to filter leads and opportunities within your CRM so that you can focus on the most likely to succeed and not waste scarce sales resources. Practically, that means each lead or opportunity is assigned a numeric score that indicates their attractiveness. Attractiveness in this context implies the likelihood that it will convert from a lead to an opportunity and from an opportunity to a sale.

While each model used for scoring is unique to the specific customer, the underlying model framework is fully automated. Salesforce automatically builds the model based on the data available in the lead and opportunity objects. You have minimal control over how this model is built, but you can use the score for various additional automated purposes. That might include alerting relevant people when a score crosses some threshold, automatically subscribing leads to a given customer journey in Marketing Cloud based on their lead score, or automatically stopping and archiving records where the score drops too low.

Einstein Forecasting

The need to increase forecast accuracy is near-universal. Very few organizations get their forecasts consistently correct. It is, therefore, not surprising that Salesforce has included an automated forecasting capability in Sales Cloud Einstein. Much like lead and opportunity scoring, Einstein Forecasting automatically analyzes data in individual Sales Cloud objects, mainly Opportunity but also others, and generates a set of predictive models to explain the outcomes.

Based on the best model, it generates several dashboards where you can see the forecast broken down by teams, with a confidence interval and information about key factors influencing the forecast. You can also see trend information based on the forecast and Einstein's prediction of future developments.

Einstein Activity Capture

Einstein Activity Capture is a way to automate some of the drudgery involved in matching emails and calendar events to Salesforce contacts and accounts. Once installed, it automatically matches emails and calendar events in your email client to existing accounts and contacts, saving you a considerable headache.

The synchronization details and how fields are mapped across can be a little tricky, but it's well worth it for the reduced manual work. Architecturally, it is also slightly different from most Salesforce offerings in that it stores information in a public cloud rather than on Salesforce itself. This has implications both for how you can use the data and for compliance.

Einstein Conversation Insights

Einstein Conversation Insights is one of the most exciting offerings in the Sales Cloud suite. It offers part-automated sales coaching via AI to improve the efficiency of sales teams. The critical ability is for AI to identify key moments within a conversation, such as the mention of a product or a competitor brand. Managers can then review this moment directly without the need to revisit the entire conversation.

That capability allows sales coaches and managers to handle a much higher volume of calls and substantially improve the feedback given to sales staff. The product also allows for analytics on top of the voice call data to see aggregate information about calls over time. Technically speaking, this is a bit more difficult to set up as it requires integrated telephony to be viable. However, there are many good options for doing this, including both native and third-party solutions.

Einstein for Service

Service is almost as commonly used on the Salesforce platform as Sales. The Service AI offering has many unique and interesting features that can help you enrich your solutions. In the following sections, we will explore how.

Einstein Bots

Chatbots are becoming ubiquitous as a channel for both sales and service. It is, therefore, not surprising that Salesforce has introduced its own bot framework directly within the Einstein platform. That means you now have the capability of building bots and exposing them via Salesforce chat, external websites, or social media channels.

The bot learns by example using natural language programming, which is to say that you define the limits of the dialogue that the bot will be able to participate in and the actions it will be able to take, but that you need to provide a certain amount of input for it to be effective. You can create chatbots without Einstein. However, it will not be able to make any kind of inferential leap. Bots can undertake a wide variety of actions on your behalf and can also escalate to a human operator if they get confused.

Einstein Case Classification and Routing

One of the most common activities within any Service Cloud implementation is working out ways to effectively route cases to the right people at the right time. Salesforce has a variety of options to deal with this area, depending on the level of complexity. Now one of them comes with AI.

Einstein Case Classification and Routing is a pre-built feature that allows easy creation of a machine learning model that enables predicting certain case fields based on other information in that record. Effectively, this will allow you to set the value of pick lists and checkboxes based on the model's best guess derived from historical data. This, in turn, will enable you to route cases based on that information using the usual methods. Thereby, companies can save the manual effort in the call center spent on classifying incomplete records.

Einstein Article Recommendations

Einstein Article Recommendations is another feature that focuses on eliminating drudgery. Searching through the knowledge base and attaching relevant articles to a case is one of the most common parts of the customer service agent's day job. The purpose of article recommendations is to partially automate this by Einstein automatically searching for similar cases and relevant articles and suggesting them directly without the need for agent interaction.

It works by building a machine learning model on top of the case object and the knowledge object. You have the option of telling it what fields to learn from and what fields are more important than others, and once this is done, agents will start seeing improved article recommendations that they can simply accept to have them tied to the case.

Einstein Reply Recommendations

Many chat interactions are quite repetitive, and Einstein Reply Recommendations leverage this fact to generate automatic reply options for customer service agents that they can use to help make chat interactions faster and more effective. Once activated and trained, the reply recommendations mode suggests replies in real time based on the current state conversation. Agents can either post these directly or edit them before posting.

Replies are generated using an advanced deep learning-based natural language processing model customized using historical data from past chats. It can, therefore, only be used where a substantial amount of historical data exists.

Einstein for Marketing

Marketing Cloud is arguably the leading digital marketing platform on the planet. The need to precisely target audiences with the right message at the right time is one that positively begs for an AI approach. We'll explore how Salesforce has risen to this challenge in the following sections.

Einstein Engagement Scoring

Einstein Engagement Scoring is a deceptively simple feature that uses a pre-built machine learning model to segment your subscribers based on their tendency to engage with the content you send out. The model is fully out of the box, but you have relatively wide opportunities for using it in your unique marketing scenario. Based on the engagement score assigned to subscribers, they are segmented into one of four groups:

  • Loyalists: The best kind of subscribers. They frequently open your emails and click on the links.
  • Window Shoppers: These subscribers open emails but have low click engagement.
  • Selective Subscribers: Choosy subscribers, have a low open rate, but if they open, they often also click through.
  • Winback/Dormant: Subscribers with both a low open rate as well as a low click engagement.

You can use these groups for specially targeted promotions with all your favorite Marketing Cloud tools. In particular, you can use these personas with the Einstein Split mechanism in Journey Builder to send different types of subscribers on different customer journeys automatically.

Einstein Recommendations

Einstein Recommendations is a feature that helps you by suggesting the most relevant next bit of content to share with a customer either through email or on the web. The feature automatically analyzes behavioral and affinity data related to customers and feeds this to a recommendation engine that you can use to produce personalized recommendations.

It relies on product or catalog data within Marketing Cloud, a prerequisite that not all users will have in place. It is also somewhat more heavyweight in configuration terms than most Einstein features we will be looking at. Once set up, however, it can be used directly within the Marketing Cloud Personalization Builder or Content Builder by using the pre-built recommendations component. That makes it very easy to deploy once the configuration has been completed.

Einstein Content Selection

When using Einstein Content Selection, email marketers can automatically customize their emails using configured business rules to maximize the click-to-open rate. Content is dynamically selected from a preexisting pool based on the underlying machine learning model's predictions and automatically tested using A/B testing to optimize even more. This allows email marketers to include the relevant component in an email template and have the AI do the rest.

Fundamentally, content selection works based on three factors:

  • Customer profile
  • Business rules
  • Content pool

That is to say, given preconfigured business rules, a set of subscribers to send to, and a pool of content to choose from, Einstein Content Selection will try to optimally pick the most relevant piece of content on a subscriber basis. The business rules give a relatively strong element of configurability to this feature. However, as with most of the pre-built Einstein features, you have no control over the underlying model.

Einstein Splits

Einstein Splits allows you to tailor your user journeys based on AI-generated personas and other factors to give truly customized experiences for your users. Various kinds of splits can be configured to tailor the path taken by particular kinds of users, selected by machine learning models based on their underlying characteristics.

Einstein Messaging/Copy Insights

Einstein Messaging Insights gives you insights automatically generated based on the characteristics of your email sends, such as an unusually high or low response rate. They appear as notifications and allow you to drill into the details.

By contrast, Copy Insights uses the same underlying information to predict what subject lines will be more effective than others. That way, you can more easily craft the right message for your audience.

Einstein Send-Time Optimization

Einstein Send-Time Optimization allows you to optimize the time your emails are sent based on the historical response rate for similar emails. You use it as part of a user journey in Journey Builder, where you have the option to choose the period over which to optimize.

Einstein for Commerce

E-commerce is an area where a strong AI offering can result in direct improvements to the bottom line in an immediate way. For that reason, Salesforce's Commerce Cloud is not shying away from introducing AI features. We'll examine how they've done this in the following sections.

Einstein Product Recommendations

Einstein Product Recommendations is the core recommendation engine for e-commerce sites built on Salesforce Commerce Cloud. It leverages a state-of-the-art, AI-driven recommendation engine to show product recommendations to shoppers dynamically. The quality of product recommendations is frequently down to the historical data quality that underlies the recommendations.

One of the unique features of the Salesforce offering is sharing data between merchants, so the pooled dataset achieves a different level of scale. As for the Einstein Recommendations feature in Marketing Cloud, you need first to configure product and catalog data and a set of business rules within the configuration module. You will also need to incorporate the product recommendations in your storefront template, a fairly technical task. Once this is done, however, the recommendation engine does the rest of the work seamlessly.

Einstein Predictive Sort

One-to-one personalization is the holy grail of marketing. The more unique and well-fitted you can make the shopping experience to the individual consumer, the higher the probability that consumer will buy your product. Einstein Predictive Sort is a way of achieving this goal for search results. The underlying machine learning model crunches profile, clickstream, and order history on a customer-by-customer basis and tailors the ordering of search results to show the most relevant products for that particular customer further up the list. In practice, you add the predictive sort as a sorting rule, among other rules you configure, which gives you a more refined degree of control.

Einstein Commerce Insights

Basket analysis is one of the most common uses of machine learning in e-commerce. It shows you sets of products typically bought together, which can help with promotions and other cross-selling initiatives.

While the algorithms to perform market basket analysis are relatively old and relatively standardized, the ability to have this information automatically preprocessed and structured into well-designed dashboards and allow you to drill through and find the exact information you need adds significant value.

Einstein Search Dictionaries

Most internet users will have experienced the frustration of searching for one word only to have it return no results because the website you are searching on uses a synonym for the same word. This common frustration has resulted in almost all major websites that provide their own search mechanism implementing a search dictionary that defines synonyms between search terms.

Einstein Search Dictionaries takes the struggle out of maintaining such a search dictionary by automatically detecting relationships between search terms and linking them to a synonym list. As with product recommendations, this can be pooled across merchants, making the feature much more powerful.

Einstein for Industry Clouds

Salesforce has recently begun having a major focus on industry solutions in recognition that challenges vary tremendously between sectors. That means that metrics and models generating insight and predictions have to vary commensurately. In the following sections, we'll explore how that works across Salesforce's industry clouds.

Health Cloud

In Health Cloud, the key focus of the pre-built solution, Tableau CRM for Health Cloud, is to provide actionable insights to help customer engagement and manage patient risk intelligently to allow proactive outreach via care programs.

The offering consists of two apps:

  • Analytics for healthcare
  • Risk stratification

They both consist of a set of pre-built dashboards that give particular insights to managers and practitioners. The first is targeted principally at managers to visualize key metrics about the patient population and enable actionable insights; the second highlights at-risk patients based on configurable patient data, enabling an appropriate response.

Financial Services Cloud

The pre-built solution for Financial Services Cloud is similar to the solution for Health Cloud in providing pre-built analytical apps. However, the range of analytical apps is much broader in scope. There are pre-built analytical solutions for wealth management, insurance, retail banking, consumer banking, a dedicated wealth starter analytics app, and an app for client segmentation analytics. The common thread between these apps focuses on customer intelligence so that financial advisers can identify high-potential clients and take appropriate action to engage with them.

Manufacturing Cloud

The Manufacturing Cloud offering consists of a manufacturing analytics app that provides 14 pre-built dashboards to manage various aspects of a manufacturing business, which we'll explore in Chapter 5, Salesforce AI for Industry Clouds. There are dedicated dashboards to analyze product performance, the health of customer account relationships, and even the individual sales agreements made between your company and key customers. Compared to the Health Cloud and Financial Services Cloud offerings, the Manufacturing Cloud offering is broader in scope and more traditional, using less of the depth of capability that the platform offers.

Consumer Goods Cloud

Consumer Goods Cloud is also focused on providing pre-built dashboards that provide actionable insights to users. It contains a pre-built analytics app, which includes dashboards for typical consumer goods use cases, such as store performance or white space analysis. In addition, it also includes embedded dashboards that you can put directly into the user interface.

For instance, users can see the analytics generated for an individual store (such as the store's top-selling products) directly when looking at the store's standard Salesforce UI. Also, it contains dedicated dashboards that allow managers to drill into data for individual merchandisers.

Nonprofit Cloud

For Nonprofit Cloud users, Salesforce offers a pre-built fundraising performance analytics app. To work successfully, you need about 3 years of running data, so it's not for new adopters unless you migrate substantial amounts of data. Once you have the data, however, you get detailed analytics on both donors and giving, as well as a KPI-based performance dashboard to help you make sense of it all.

Declarative Platform Services

Declarative Platform Services allows administrators and configurators to build custom AI capabilities using clicks, not code. They are often the best way to achieve organization-specific AI functionality. We'll explore the various ways this can be achieved in the following sections.

Einstein Next Best Action

Einstein Next Best Action is one of the most powerful declarative features in your platform arsenal because it allows you to leverage all the analytical and predictive data generated by the other AI features in an action-based strategy. Simply put, Einstein Next Best Action surfaces recommendations directly in the user's normal workflow based on configurable strategies that can use key insights from your machine learning or analytical models to drive the choice. That way, you can impact user behavior at precisely the right time to drive better outcomes for your customers.

The configuration is not simple, and we will cover it in detail in Chapter 7, Building AI Features with Einstein Platform Services. However, the flow works by you outlining a set of recommendations that can be made to users, embedding these in action strategies, integrating the output of your predictive models to enable advanced intelligence in the decision-making, and configuring a component so that you can show these suggestions in the user interface.

Einstein Prediction Builder

Einstein Prediction Builder is probably the most powerful feature you have at your fingertips in the Einstein platform that you can access without writing a line of code. Salesforce refers to it as custom AI for admins, which is to some extent fair. The feature allows you to predict the outcome of Boolean or numeric fields on your Salesforce records based on historical data in the underlying objects.

You have a wide range of configuration options, including what fields to include in the prediction, what data to train on and which to exclude, and where you want to store your predicted outcome. It also comes with extensive monitoring tools that allow you to assess the quality of your prediction. However, you do not have any control over what machine learning model is chosen to predict your data.

That way, you can have the prediction running in the background for an extended period and only deploy it into the user experience when you are comfortable that it works as intended. The prediction itself, because it is stored directly in the data model, can be used throughout the Salesforce platform, including all the standard automation features.

Einstein Discovery

Einstein Discovery is where the AI features of the platform meet the analytical ones. Like Einstein Prediction Builder, Einstein Discovery uses supervised machine learning models based on existing data. However, the purpose of Einstein Discovery is not first and foremost to predict future outcomes but to gain deep insights that will allow you to change those outcomes by taking appropriate action.

In the terminology of the tool, what Einstein Discovery generates is a story, that is to say, a beautifully visualized statistical model that shows what factors contributed the most to the outcomes we have observed. For instance, we may find that color is a significant determinant of product sales in our catalog, but that one particular shade of green that sells exceedingly well in Bavaria is a death knell to a product sold in Provence.

The insights you generate with Einstein Discovery can be made actionable in several ways. This would typically be as parts of reports or dashboards, or as contextual information for a record. But it is also possible to make them directly actionable within the Salesforce platform, for instance as part of an automation.

Programmatic Platform Services

Programmatic Platform Services is the most powerful set of services you will have at your disposal when working with AI on-platform. They allow you to tap directly into the AI capabilities of the Salesforce platform by calling APIs. In the following sections, we will introduce the various options.

Einstein Vision

Einstein Vision is a powerful programmatically accessible API that allows developers to access both pre-trained classifiers and to train custom classifiers to solve a range of different use cases in the computer vision domain. The first service is image classification that enables you not only to detect cats in YouTube videos but also, for instance, to classify images in your content catalog or uploaded content from your user base to automate and enrich your business processes.

You can also use Einstein Vision for object detection, which can give you granular details about the size and location of objects in an image, something that can be very useful, for instance, in a field service setting. Finally, an OCR service can help you to convert all of that printed documentation that might still exist within your company into a digital form.

Einstein Language

Einstein Language is the second central API released as a part of Einstein Platform Services. As with the Vision API, you have the option of using pre-built models or creating custom models for your language domain. The first service, sentiment analysis, analyzes text to give an indication of the emotional valence it conveys. You can use it, for instance, to detect negative comments and respond with a support follow-up automatically or, conversely, detect positive statements to give people a thumbs up.

The intent API instead categorizes unstructured text into user-defined labels, trying to map the unstructured text into a more meaningful context that you can use for routing in automation. For instance, you can detect different topics within text messages and automatically respond to the right person for handling.

Finally, the named entity recognition (NER) API allows you to detect entities in unstructured text. For instance, you could detect every time somebody uses a currency amount and your company stock ticker symbol to detect conversations about target stock prices.