Coupa Connector for Mulesoft

Revised: 02 March 2021

Introduction

This connector facilitates the integration with the Coupa’s API providing a mean to access Coupa web services. You can use Coupa connector within mule flows to send and receive data using the Coupa API with support of latest oAuth2/OIDC authentication.

It provides access to Addresses | Advanced Ship Notice | Approvals | Contracts | Receipts aka Inventory Transactions | Items | Lookup Values | Purchase Orders | Requisitions | Suppliers | Users | Charges | CoupaPay Payments | Expense Reports | Invoice | Supplier Items | Remit-to Addresses | Statements | Dynamic Discount | Projects | Tasks | BudgetLine | BudgetLine Adjustments | Easy Form Responses | Supplier Information.

Read through this user guide to understand how to set up and configure a basic flow using the connector. Track feature additions, compatibility, limitations and API version updates with each release of the connector using the Connector Release notes attached below. Review the connector operations and functionality using the demo application attached below.

Additional details on Coupa connector: Mule Exchange Site.

MuleSoft maintains this connector under the Certified support policy.

Prerequisites

This document assumes that you are familiar with Mule, Anypoint StudioAnypoint Core Components and Mule Flow Design Center.

Hardware and Software Requirements

For hardware and software requirements, please visit the Hardware and Software Requirements page.

Compatibility

Software Version

Mule Runtime

4.1.x and higher

Installing the Connector

You can install the connector in Anypoint Studio using the instructions in Installing a Connector from Anypoint Exchange.

Configuring the Connector Global Element

To use the Coupa connector in your Mule application, you must configure a global Coupa element that can be used by the Coupa connector. The Coupa connector offers the following global configuration(s), requiring the following credentials: Coupa API Key and Instance:

To use the Coupa connector in your Mule application, you must configure a global Coupa element that can be used by the Coupa connector. The Coupa connector offers the following global configuration(s), requiring the following credentials: Coupa API Key (Deprecating from R35), OIDC Client Credentials and Instance:

You can generate client credentials on Coupa instance at following path: https://{instance_name}/oauth2/clients

Reference documentation for OIDC/Oauth2: Get Started With the Coupa API

Field Description

Coupa API key

Enter the API Key retrieved from your Coupa admin or Integration Architect for API authentication (This option will deprecate from R35. Use OIDC client credentials as an alternative to traditional API key).

Instance

Populate Coupa instance URL here.
Example: https://customer_name.coupahost.com

OIDC Client ID

Enter the client ID retrieved by your Coupa admin or Integration Architect required for OIDC authentication.

OIDC Secret

Enter the client secret retrieved by your Coupa admin or Integration Architect required for OIDC authentication.

OIDC Scope

Enter the list of scopes applied on client credentials for OIDC authentication.

user-guide-01.png

Configuration tips

  1. API Key parameter in above config can be kept blank while opting for OIDC authentication.
  2. In case API Key is populated along with OIDC client credentials (client id, secret, scope), priority will be given to OIDC authentication.

Configuration notes

  1. core.user.read is mandatory scope required to complete test connection successfully with OIDC authentication.
  2. Multiple OIDC scopes can be separated with one of the following delimiters - Comma, Space, %20.

Examples

  • core.invoice.read,core.purchase_order.read,core.user.read
  • core.invoice.read, core.purchase_order.read, core.user.read
  • core.invoice.read core.purchase_order.read core.user.read
  • core.invoice.read%20core.purchase_order.read%20core.user.read

Using the Connector

Connector Namespace and Schema

When designing your application in Studio, the act of dragging the connector from the palette onto the Anypoint Studio canvas should automatically populate the XML code with the connector namespace and schema location.

 Tip

If you are manually coding the Mule application in Studio’s XML editor or other text editor, define the namespace and schema location in the header of your Configuration XML, inside the <mule> tag.

<mule xmlns:coupa="http://www.mulesoft.org/schema/mule/coupa" xmlns="http://www.mulesoft.org/schema/mule/core"
 xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/coupa http://www.mulesoft.org/schema/mule/coupa/current/mule-coupa.xsd">
   <!-- put your global 0configuration elements and flows here -->
</mule>

TIP

Inside the <version> tags, put the desired version number, the word RELEASE for the latest release, or SNAPSHOT for the latest available version. The available versions to date are: 4.0.0

Demo Mule Applications Using Connector

Existing demo demonstrate how to use the connector for:

Example Use Case

The following example shows how to get an invoice using the connector:

Get an invoice

  1. In Anypoint Studio, click File > New > Mule Project, name the project, and click OK.
  2. In the Mule Palette, click on the "HTTP" group and select the Listener component. Now drag and drop it into the flow designer.
  3. First, we need to create a configuration for the HTTP listener before using it. Click on the HTTP listener and add new configuration by pressing the green plus icon.
  4. Leave the defaults and click OK.
  5. Set the value to "show-invoice".
    user-guide-04.png
  6. In the Mule Palette, click on the "Coupa" group and drag and drop Get into the flow designer, then create a new configuration and set your API Key and the instance URL.
  7. In the Coupa General section, for Object type pick Invoice (invoice) and put 1 (or any valid invoice id) in the ID field.
    user-guide-02.png
  8. Finally, you can try the demo making a request to http://localhost:8081/show-invoice
Note

After an object type is selected, the output metadata view is getting generated based on the pick

Error handling

The connector might generate a different type of errors while using it in flows. It is good to configure separate strategy for every error type using the Error Handling components.

Coupa Errors:

  • COUPA:CONNECTIVITY
  • COUPA:EXECUTION
  • COUPA:INVALID_AUTH
  • COUPA:INVALID_PARAMS

Configuring custom fields

Custom fields can be added on top of the basic datasense fields. Available data types for custom fields are StringDateDate_TimeIntegerDoubleFloatLongDecimalBoolean and Reference.

Example configuration:

some-custom-field,String; other-custom-field,Date_Time; custom-reference-field,Reference:user

Custom fields can be add in the Custom Metadata tab of the Coupa Global Configuration.

user-guide-08.png

API Resources

Mule Module Documentation

Mulesoft Connector Documentation

Coupa Connector Release Notes

Support Resources