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.
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.
- Find any new email with meetup in the subject and an attachment in Gmail.
- Invoke the Marketing Leads Extractor RPA process to extract leads from the attachment and return the leads to MuleSoft Composer.
- For each extracted lead, determine if a corresponding lead exists in Sales Cloud.
- 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 |
|
MuleSoft RPA |
|
NTO’s Sales Cloud |
|
Slack |
|
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.
- Log in to MuleSoft RPA Manager using your username and password.
- Look at the URL of your MuleSoft RPA Manager instance. For example, in this use case it’s
https://myOrg.rpa.mulesoft.com
. - Append
/rpa/api/v1
to the URL to form the RPA API URL. Using the preceding example, your RPA API URL ishttps://myOrg.rpa.mulesoft.com/rpa/api/v1
. - 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.
- 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.
- Click the Copy to clipboard icon of the user API key associated with the user with privileges to the RPA process.
- 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.
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.
- Go to https://developer.salesforce.com/signup.
- Enter your contact information.
- Enter a unique username.
- Click Sign me up, and wait for your welcome email.
- 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.
- Access slack.com, click LAUNCH SLACK, and then select Create a new workspace.
- Enter your email address and click Continue.
- Check your email for a confirmation code sent by Slack and enter it in Slack.
- Enter
NTO
as the name of your company, and click Next. Your workspace is NTO. - Enter
sales-leads
as the project your team is working on, and click Next. Your channel is sales-leads. - 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.
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.