Skip to main content
Join Trailblazers for Dreamforce 2024 in San Francisco or on Salesforce+ from September 17-19. Register now

Examine an Integration Use Case

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe the challenge of keeping handwritten leads in Gmail in sync with leads in Salesforce and notifications in Slack.
  • Explain how to use MuleSoft Composer and MuleSoft RPA to sync handwritten leads in Gmail with leads in Salesforce and notifications in Slack.
  • Prepare to create a flow.

Before You Start

This module builds on MuleSoft Composer Installation and Configuration, so make sure to complete it before you continue. Recall from that module, you need to have the MuleSoft Composer User permission set if you want to build and run integration flows.

In this module, we assume you’re an authorized MuleSoft Composer user. If you’re not a MuleSoft Composer user, that’s OK. Read along to learn how they perform the steps. Don’t try to follow the steps in a Trailhead Playground, because MuleSoft Composer isn't available in the Trailhead Playground.

Note

To learn about MuleSoft Composer’s integration features, flow components, and flow creation tasks, take MuleSoft Composer Basics.

Because you use a MuleSoft RPA process in this module, be familiar with MuleSoft RPA. To learn about MuleSoft RPA’s features and components, take MuleSoft RPA Basics.

In this unit, you step into the role of admin for Northern Trail Outfitters (NTO), an outdoor and recreational gear retailer. First, you examine an integration challenge faced by NTO, and then you learn about a MuleSoft Composer integration solution. Finally, you learn how to prepare to create your flow.

Integration Challenge

Let’s take a look at an integration challenge NTO is facing. Your sales team at NTO receives emails containing handwritten leads collected from attendees at marketing events from the marketing team. For best customer relationship management, the sales team manages and maintains all leads in Sales Cloud. To improve lead management and foster team collaboration, the sales team also notifies the sales-leads Slack channel about new leads.

Currently, the sales team performs these tasks manually. Every time there’s a new email with an attachment containing leads, the team downloads the attachment and reviews the leads. For each lead, they check if there’s a corresponding lead in Sales Cloud. If not, they create a corresponding lead in Sales Cloud. Finally, they send a message with relevant lead details to the sales-leads Slack channel. This process is time-consuming and highly error-prone, so the team wants to automate it.

Integration Solution

As a solution, you need to automate the integration between Gmail, Sales Cloud, and Slack to achieve near real-time integration. To do this, you use MuleSoft Composer and MuleSoft RPA to create an integration flow that automatically syncs handwritten leads in Gmail with leads in Salesforce and notifications in Slack.

In this flow, MuleSoft Composer and MuleSoft RPA work as members of an automation tag team.

  • MuleSoft Composer performs the overall business process automation by running the flow. The flow starts when an email with an attachment is received, invokes the RPA process to extract leads, populates Sales Cloud with relevant leads, and notifies the sales-leads Slack channel.
  • MuleSoft RPA performs the manual task automation by running the RPA process when invoked by MuleSoft Composer. The RPA process downloads attachments, parses text, extracts leads, and returns the leads to MuleSoft Composer.

Specifically, the flow must perform the following tasks.

  1. Find any new email with meetup in the subject and an attachment in Gmail.
  2. Invoke the Marketing Leads Extractor RPA process to extract leads from the attachment and return the leads to MuleSoft Composer.
  3. For each extracted lead, determine if a corresponding lead exists in Sales Cloud.
  4. If the lead doesn’t exist:
    • Create a corresponding lead in Sales Cloud.
    • Post a message with relevant lead details to the sales-leads Slack channel.

To implement the solution using MuleSoft Composer, you perform these flow creation tasks.

  • Prepare to create a flow.
  • Design and test a flow.
  • Activate a flow.
  • Monitor and troubleshoot a flow.

You learn how to perform these tasks in the rest of this module.

Prepare to Create a Flow

Ready to get started?

First, gather all required information about the systems and assets your flow is going to use. The following table describes the systems the flow needs to connect to and the information you need for those systems.

System Required Information

Gmail

  • User ID and password with appropriate permissions to the account that emails with attachments are sent

MuleSoft RPA

  • User ID and password with appropriate permissions to the MuleSoft RPA Manager instance
  • RPA API URL of the MuleSoft RPA Manager instance
  • User API key for a user with appropriate privileges to the Marketing Leads Extractor RPA process

NTO’s Sales Cloud

  • URLs of the NTO sandbox and production orgs
  • Username and password with appropriate permissions to the NTO orgs

Slack

  • Workspace
  • Channel
  • User ID and password with appropriate permissions

As a best practice, use a test environment for these systems and data when you design and test your flows. After you complete testing, run the flows using your production systems and data.

Next, you learn about the prerequisites for your Gmail, MuleSoft RPA, Salesforce, and Slack environments.

Prerequisites for the Gmail Environment

We assume you have a Google account that allows you to access everything Google including Gmail. If you don’t have a Google account, sign up for a free account.

When you create a connection to Gmail using MuleSoft Composer, you’re prompted to grant MuleSoft Composer permissions to your Google account. Be ready to grant MuleSoft Composer the following permissions.

  • View your email messages.
  • Search your email messages.
  • View your settings.
  • Send email on your behalf.

Prerequisites for the MuleSoft RPA Environment

First, when you create a connection to MuleSoft RPA using MuleSoft Composer, you must specify values for the following parameters.

Connection Display Name

The connection display name is any name of your choice.

RPA API URL

To find the RPA API URL of your MuleSoft RPA Manager instance, follow these steps.

  1. Log in to MuleSoft RPA Manager using your username and password.
  2. Look at the URL of your MuleSoft RPA Manager instance. For example, in this use case it’s https://myOrg.rpa.mulesoft.com.
  3. Append /rpa/api/v1 to the URL to form the RPA API URL. Using the preceding example, your RPA API URL is https://myOrg.rpa.mulesoft.com/rpa/api/v1.
  4. Copy and paste the RPA API URL to a text file of your choice.

User API key

We assume you know the name of the user with the appropriate privileges to the RPA process that you need to invoke in your flow. To find the user API key of this user, follow these steps.

  1. In MuleSoft RPA Manager, click User Management | User API keys. The User API Keys table appears, showing the list of user API keys and associated users.
  2. Click the Copy to clipboard icon of the user API key associated with the user with privileges to the RPA process.
  3. Paste the user API key to the same text file and save it.

Next, let’s take a closer look at the Marketing Leads Extractor RPA process you use in your flow. Here’s an example of an email attachment this RPA process would extract leads from.

Meeting sign-in sheet with attendees’ first name, last name, company, phone, and email.

In a nutshell, the Marketing Leads Extractor performs the following tasks.

  • Reads the specified email based on the provided email subject.
  • Downloads the email’s attachment.
  • Extracts text from the attachment using Amazon Textract’s Tables OCR (optical character recognition) functionality.
  • Calls a specified MuleSoft Anypoint Platform web service to transform the text into a JSON (JavaScript Object Notation) format consumable by MuleSoft Composer.
  • Returns the results as a list of leads to MuleSoft Composer.

Based on this information, be ready to perform the following tasks in your flow.

  • Create and configure an action step to invoke the Marketing Leads Extractor RPA process with
    • The subject from Gmail as the input
    • The response from the RPA process as the output to be used in the flow
  • Create and configure a For Each flow component to iterate over the list of leads returned from the RPA process.

Prerequisites for the Salesforce Environment

First, we assume you have a sandbox org and a production org to build and run flows that sync with Salesforce.

Note: If you don’t have a sandbox org to design and test your flows, you can use a developer org.

Follow these steps to sign up for a free developer org.

  1. Go to https://developer.salesforce.com/signup.
  2. Enter your contact information.
  3. Enter a unique username.
  4. Click Sign me up, and wait for your welcome email.
  5. In the welcome email, click the link to set your password.

Next, when you create a connection to Salesforce using MuleSoft Composer, you’re prompted to grant MuleSoft Composer permissions. Ensure your Salesforce accounts for both your sandbox and production orgs are ready to grant MuleSoft Composer the following permissions.

  • Access the identity URL service.
  • Manage user data via APIs.
  • Perform requests at any time.

Prerequisites for the Slack Environment

To post notifications about leads to a predefined Slack channel, you need a Slack workspace and channel. Follow these steps to create a test Slack workspace and channel.

  1. Access slack.com, click LAUNCH SLACK, and then select Create a new workspace.
  2. Enter your email address and click Continue.
  3. Check your email for a confirmation code sent by Slack and enter it in Slack.
  4. Enter NTO as the name of your company, and click Next. Your workspace is NTO.
  5. Enter sales-leads as the project your team is working on, and click Next. Your channel is sales-leads.
  6. When prompted to add people, click Skip this step, click Skip Step, and then click Let’s Go to go straight to your workspace and channel.
    Slack NTO workspace with sales-leads as a channel.

When you create a connection to Slack using MuleSoft Composer, you’re prompted to grant MuleSoft Composer permissions. Be ready to grant MuleSoft Composer the following permissions to your Slack workspace.

  • View content and info about channels and conversations.
  • View content and info about your workspace.
  • Perform actions in channels and conversations.

You’ve taken the first steps to prepare to create your flow with MuleSoft Composer. In the next unit, you learn how to design a flow.

Resources