MuleSoft Anypoint is a complete API management solution that allows you to build, test, and deploy APIs. If you use a CRM or external business platform and you need to automate the exchange of information with Turvo, you can use MuleSoft Anypoint platform to create custom APIs that send data to or retrieve data from Turvo in near-real time. If you would like to use MuleSoft to connect to Turvo, reach out to your Turvo representative.
MuleSoft enables linking between platforms by allowing you to build workflows between platform connectors using their Anypoint Studio tool. A connector is a platform-specific element that contains information about the characteristics of the platform and allows the API to make a connection. This means that any CRM or platform that you’d like to connect with must have a connector that is certified with MuleSoft and available to download from Anypoint Exchange, which is their connector marketplace.
MuleSoft provides extensive, in-depth documentation regarding the full parameters of Anypoint Studio and the available connectors. This guide is not intended to provide an exhaustive description of every available function or option. Instead, this guide serves as an introduction to the platform and helps you get started.
Specifically, this guide covers:
- The Anypoint Exchange library
- The AnyPoint Studio platform layout and functionality
- An example use case - Automating locations between Turvo and Salesforce
For a reference guide detailing every configuration for the Turvo connector, see Turvo's MuleSoft connector reference.
For a list of updates to the Turvo connector, see Turvo's Mulseoft connector release notes.
Anypoint Exchange is a library of prebuilt assets that includes connectors, templates, examples, and APIs. To download assets, you must have a valid Anypoint Platform account (MuleSoft allows a trial period).
Within Anypoint Exchange, you can search for specific assets by entering keywords into the search bar.
If you want to browse by asset type, select the type from the drop-down menu to the left of the search bar.
Once you have located the asset you’re interested in connecting with, selecting the asset will take you to the asset page, which includes a full description, user reviews, and other helpful information provided by the developer.
To download the asset, select the Download button on the right side of the screen.
Alternatively, you can download assets through the Anypoint Studio platform.
The Anypoint Studio platform is the software interface where you can build, test, and deploy your API workflows.
The Package Explorer pane is located on the left side of the application. You can navigate to your stored files without having to open a separate window.
Right-clicking the main project file and selecting Properties allows you to access many of the main configuration options.
Protip: You can import files quickly by right-clicking inside the Package Explorer pane and selecting Import.
The Mule Palette pane is located on the right side of the application. This is where you can select the connectors and operations to add to your API workflow.
The left side of the pane shows the available connectors. To add more, select Add Modules; a list of suggested connectors displays.
If you want to search Anypoint Exchange for a connector (or other asset), select Search in Exchange.
Each connector has a set of prebuilt operations available. Select the connector to display a list of the operations on the right side of the pane.
You can build out your API workflow by dragging and dropping an operation into the Message Flow pane in the top middle portion of the application.
The Message Flow pane is where you can build out the step-by-step process for your API. The API is visually presented in a flowchart style. Icons represent the connector operation steps; these icons are connected by arrows that show the flow path of the API.
The Message Flow pane can also display the Global Elements and Configuration XML by selecting those buttons at the bottom of the pane.
Connector operations often require individual configuration beyond the prebuilt functions. You can access these configuration options by selecting the connector operation icon and viewing the Mule Properties pane on the bottom of the application.
The Mule Properties are relative - what you see displayed depends on what is selected in the Message Flow pane. The left side of the pane contains a selectable menu of configurable properties.
Selecting an option on the menu displays the options that relate to that menu item.
Protip: MuleSoft maintains an extensive documentation library that provides significant information about the available connectors and their operations. Use this resource to learn more about how to configure your API to meet your business needs.
Example use case: connecting Salesforce and Turvo
To work on an API you must download and install the Anypoint Studio application.
It is strongly recommended that you work through Getting Started with MuleSoft - Hello Mule to introduce you to the basics of creating, building, and testing a project in Anypoint Studio. Once you’ve learned the basics, you are ready to build a more complex workflow.
The following Turvo-specific example is meant to illustrate how a more complex workflow operates. In this case, the business need is to automatically create a location in Turvo when a new location is added to Salesforce.
Protip: This application is built to connect Salesforce to a test environment in Turvo. It is a best practice to test your APIs in a sandbox before deploying to a live environment.
The first step in building an API is to open a new Mule project. Select File → New → Mule Project from the main menu bar. This project has been named testturvosfflow.
Connectors can be downloaded from Anypoint Exchange or by selecting Add Modules from the Mule Palette. Once imported, both the Salesforce and Turvo connectors display in the Mule Palette.
You will need login credentials to use the Turvo connector. Reach out to your Turvo representative to gain access to the connector operations.
To log into the connector, select the Global Elements button at the bottom of the Mule Palette pane.
Select the Turvo Configuration element and select Edit.
A new window displays that contains login fields.
Protip: You can verify that you are logged into the connector by selecting the Test Connection button.
Building the workflow steps
You can build an API workflow by dragging and dropping connector operators from the Mule Palette pane into the Message Flow pane.
From the Message Flow window, selecting a connector displays the available operators specific to that connector.
Drag the connector operators to the Message Flow pane in the order that you want the workflow to function.
The workflow steps for this API function happen in the following sequence:
Step 1: Replay Channel Listener
From the Salesforce connector, add the Replay Channel Listener to the Source area.
Because the goal is to create a new location in Turvo when one is entered into Salesforce, the Turvo connector first needs to “listen” to Salesforce continuously to pick up when a new location is created. The Replay Channel Listener does just that.
In this case, the Streaming Channel determines what the API is listening for, and the Replay Option specifies that the listener is only interested in new locations.
Step 2: Logger
From the Core connector, add the Logger operation to the Process area.
A Logger component helps you monitor and debug your API by logging important information such as error messages, status notifications, payloads. In this step the API needs to log the information that the Listener picked up. The logger is set to INFO in the properties.
Step 3: Choice Router
From the Core connector, add the Choice operation after the Logger.
The Choice router adds conditional processing to a flow, similar to an if/then/else code block in most programming languages. This choice router is telling the API to perform the downstream workflow steps (in the top box) when a new location is detected in Salesforce.
Multiple workflow options can be added to an API in the blank box under the existing workflow. The Choice Router contains the rules that determine which workflow occurs.
Step 4: Retrieve
From the Salesforce connector, add the Retrieve operator.
The Retrieve operation pulls the information previously identified. Note that the icon is the Salesforce logo; this means the operation was pulled from the Salesforce connector.
The Type property field specifies that the information being pulled is a location. The Retrieve Request field contains the exact fields being retrieved from Salesforce.
Step 5: Logger
From the Core connector, add the Logger operator.
In this step the API is recording information about the Retrieve operation. The logger is set to INFO in the properties.
Step 6: Transform Message
From the Core connector, add the Transform Message operator.
The Transform Message operation is the heart of the data exchange between Turvo and Salesforce. This is the element where the exact fields between the two platforms are mapped to each other.
The Transform Message properties display the lists of available fields. The graphic in the middle shows the mapping lines. Mapped fields appear as black text; unmapped fields appear as grey text.
Step 7: Location Create
From the Turvo connector, add the Location - Create operator.
The Location Create operation builds the new location data in Turvo. The information that is created in Turvo depends on the fields mapped in the Transform Message step.
Step 8: Logger
From the Core connector, add the Logger operator.
In this step the API is recording information about the Location Create operation. The logger is set to INFO in the properties.
Running the API workflow
Once an API workflow is built, it must be run before it is active. To run the API, select the Run button from the main menu bar.
Alternatively, you can right-click inside the Package Explorer window and select Run As → Mule Application from the menu.
The Mule Properties pane displays the API running through the workflow. The workflow may take a few minutes to finish running.
Once the workflow runs without error, it is ready to test. In this case, creating a new location inside Salesforce should create a new location in Turvo.