Tech Topics

B2B SaaS Integrations: Working with the Messy Middle

B2B SaaS Integrations: Working with the Messy Middle

When we think of creating integrations for B2B SaaS apps, APIs and API connectors come quickly to mind. But, in addition to the APIs and the code that connects these APIs to the integration, we also have what we might call the "messy middle." This is the portion of an integration where we choose to perform any number of actions on the integration and its data.

Yes, a data integration sends data from one system to another. And sometimes, it's that straightforward. But other times, even a relatively simple integration may require some additional work help.

Imagine your customer's order system exports high-level order data to your SaaS product. Here are the data elements (fields) for the order record from your customer's system: order_id, order_amount, order_currency, order_date, and customer_id .

A brief look seems to indicate that you can pass this data from your customer's order system to your SaaS product. After all, it's only five fields and seems simple. But a bit of context might demonstrate a need to make some changes even for a simple dataset.

In this example, we'll say the currency is US dollars. But your SaaS product needs the currency in euros. As a result, you would need to take the order_amount , order_currency, and order_date to calculate the cost in euros on the specified date. Then, you would update the order record accordingly, changing the value of order-currency to euros and the value of order_amount to what we just calculated. Finally, you'd send the modified data on to your SaaS product.

This is a single example of a calculation for an integration. The actual list of things we could do within an integration is practically infinite. Still, many of the functions commonly performed in the messy middle of an integration will fall into one of the following categories.

  • Text Manipulation
  • Math Logic
  • Data Mapping
  • Data Format Conversions

Let's look at each of these and review examples of how you might use them.

Text Manipulation

A typical example of text manipulation is joining two or more text fields (strings) into a single string.

Let's use the example of your SaaS product and your customer's email system. The integration takes user data from your app and inserts it into your customers' to match elsewhere.

In your system, a user has a first name user_fname and a last name user_lname. The email system needs fullname. We'll use text manipulation in the integration to join user_fname, a space, and user_lname to get fullname to send to your customer's email system.

Of course, you can do much more than simple joins with text manipulation, including case changes, regex matching, find and replace, string splitting, and even encoding or decoding strings in base64.

Math Logic

Remember the example integration we used in this post's introduction? The one where we needed to convert from one currency to another? That is an excellent example of an integration that requires some math in the messy middle.

To restate what we did earlier, we would need to take the cost in US dollars for the order on the day it was made and convert it to the cost in euros for the same day. Beyond the math function required to use a conversion rate for USD to EUR, we would also need to perform a lookup to some standard third-party service to get the conversion rate for that day since the rate may change daily.

Math functions within integrations can, of course, be far more complicated than this. However, the basic principle is the same: numbers from the source system must be added/multiplied/divided/subtracted before being sent to the destination system.

Data Mapping

It's common for two systems to have different naming conventions for their data schemas. As a result, data that flows from one of those systems to another via an integration needs to have data mapping.

We'll use an example where an account record from your SaaS app needs to be sent to your customer's accounting system. Here are the data elements from each. You'll need code in the integration that maps the data element on the left to the one on the right before the data is sent to your customer's accounting system.

Your SaaS Product Your Customer's Accounting System
account_number 3pacctno
account_name acctname
account_address1 acctaddress1
account_address2 acctaddress2
account_city acctcity
account_state acctstate
account_postal_code acctpcode
account_phone acctphone

Data mapping can be simple, like our example here, or complex. A complex example would include taking a flat data structure (like a CSV file) and mapping it to a nested object (XML or JSON) or vice versa. The bottom line is that data mapping allows us to alter metadata from the sending system into a format acceptable to the receiving system.

Data Format Conversions

Every native integration works with data formats, with XML and JSON being two of the most common. Sometimes the apps on both ends of an integration use the same format, but often you'll need to convert from one format to another as part of the integration.

For example, you have a customer with a project management app who needs to send tasks to your B2B SaaS product. The project management tool exports the data in XML, but your product can only accept data in JSON.

Here's what the exported data looks like from your customer's app.

<task>
	<task_ID>687834</task_ID>
	<taskowner>Meghan McMoyle</taskowner>
	<project>Spring Hill Factory</project>
	<type>Critical</type>
</task>

Within the integration, you take the XML data your customer provides and run it through a data format conversion to JSON. It comes out the other end looking like this:

{
    "task": {
        "task_ID": 687834,
        "taskowner": "Meghan McMoyle",
        "project": "Spring Hill Factory",
        "type": "Critical"
    }
}

Of course, there are more data formats that you could convert between, such as CSV, and YAML, to name a couple.

Conclusion

If it weren't for the messy middle, B2B SaaS integrations would be a breeze. Set up auth for both systems. Extract data via one API and send it to another. Done.

But that's different from the reality of most integrations. Most integrations depend on text manipulation, math logic, data mapping, data format conversions, and a score of other actions to ensure that the data from system A is organized, formatted, and otherwise modified before going to system B.

Traditionally, developers have built custom code for everything in the integration, including everything in the messy middle. However, modern tools, such as Prismatic's embedded integration platform, come with pre-built components to do everything we've covered here and more.

Contact us if you'd like to see how an embedded integration platform can make every type of integration simpler so you can add integrations to your SaaS app faster.


About Prismatic

Prismatic is the integration platform for B2B software companies. It's the quickest way to build integrations to the other apps your customers use and to add a native integration marketplace to your product. A complete embedded iPaaS solution that empowers your whole organization, Prismatic encompasses an intuitive integration designer, embedded integration marketplace, integration deployment and support, and a purpose-built cloud infrastructure. Prismatic was built in a way developers love and provides the tools to make it perfectly fit the way you build software.

Get the latest from Prismatic

Subscribe to receive updates, product news, blog posts, and more.