CAQH Connector | MuleSoft Documentation
# CAQH Connector
CAQH Connector v1.0
Anypoint Connector for the Council for Affordable Quality Healthcare (CAQH Connector) provides access to a nonprofit that collects, stores, monitors, and validates healthcare providers’ information.
CAQH ProView® is a web-based solution that many providers use to self-report and share wide-ranging demographic and professional information with healthcare organizations. CAQH DirectAssure®, which ensures the accuracy of provider directories, works in tandem with CAQH ProView, so providers can update their directory information in one place and share it with participating organizations.
CAQH ProView and DirectAssure APIs enable users to retrieve information about providers in real time for credentialing and other purposes. Participating organizations (POs) can use the APIs to add a provider to roster in CAQH ProView. CAQH Connector simplifies access to the CAQH ProView and DirectAssure APIs to define complex integrations visually for enhanced provider management and credentialing.
Release Notes: CAQH Connector Release Notes Exchange: CAQH Connector
## Before You Begin
To use this information, you should be familiar with CAQH ProView, DirectAssure, Mule concepts, Anypoint connectors, Anypoint Studio, the elements in a Mule flow, and global elements. The APIs use basic authentication, based on username and password. You need a CAQH account and credentials to use the connector.
To use the CAQH connector with Maven, find dependency information on the Dependency Snippets tab of CAQH connector’s page on the Anypoint Exchange.
## POM File Information
```
<dependency>
 <groupId>com.mulesoft.connectors</groupId>
 <artifactId>mule-caqh-connector</artifactId>
 <version>x.x.x</version>
 <classifier>mule-plugin</classifier>
</dependency>
```

Replace `x.x.x` with the version that corresponds to the connector you are using.
To obtain the most up-to-date `pom.xml` file information, access the connector in Anypoint Exchange and click **Dependency Snippets**.
## Add the Connector to Your Studio Project
Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.
### Add the Connector Using Exchange
  1. In Studio, create a Mule project.
  2. Click the Exchange icon **(X)** in the upper-left of the Studio task bar.
  3. In Exchange, click **Login** and supply your Anypoint Platform username and password.
  4. In Exchange, search for "caqh".
  5. Select the connector and click **Add to project**.
  6. Follow the prompts to install the connector.


### Add the Connector in Studio
  1. In Studio, create a Mule project.
  2. In the Mule Palette view, click **(X) Search in Exchange**.
  3. In **Add Modules to Project** , type "caqh" in the search field.
  4. Click this connector’s name in **Available modules**.
  5. Click **Add**.
  6. Click **Finish**.


## Connector Namespace and Schema
When you drag the connector from the Mule Palette view in Anypoint Studio to the canvas, Studio populates the XML code for the connector namespace, schema location, and POM file. If you create an app outside of Studio, use this information in the XML:
Namespace: `http://www.mulesoft.org/schema/mule/caqh` Schema Location: `http://www.mulesoft.org/schema/mule/caqh/current/mule-caqh.xsd`
## Configure CAQH Connector in Anypoint Studio
  1. In Anypoint Studio, create a new Mule project. Ensure that you have **HTTP Listener** configured.
  2. Drag the connector to the Studio Canvas.
  3. Configure the connector’s global element. You can either enter your credentials as global configuration properties or reference a configuration file that contains these values. For simpler maintenance and better reuse of your project, MuleSoft recommends that you use a configuration file.
     * **Address** : URL to access CAQH API
     * **Username** : The user name to access CAQH API
     * **Password** : Password to access CAQH API
An example configuration file for CAQH is available at `src/main/resources/configuration.yml`. You can add this file in the Configuration Properties of the Global Configuration Elements.   
---  
  4. To ensure that your connection is successful, Click **Test Connection**.
  5. Select a connector operation.


## Use Cases
The following use cases demonstrate how you can use this connector to:
  * Update providers from Salesforce to CAQH using ProView
  * Delete Providers from Roster Using ProView


To test these the use case examples:
  1. Create a Mule application, and set the connector configuration properties in the configuration file in the `src/main/resources`. For example,
```
caqh:
 address: "<url-to-access-caqh-api>"
 user: "<username-to-access-caqh-api>"
 password: "<password-to-access-caqh-api>"
```

  2. Add the configuration file for the CAQH connector to the Configuration Properties of the **Global Configuration Elements**.


### Update a Provider from Salesforce to CAQH Using ProView
In this example, a Mule application queries Salesforce contacts to find a provider. It then updates the provider’s status in CAQH and gets the status of the update request.
In your Mule application,
  1. Drag an HTTP Listener to the canvas and configure it.
  2. From the **Palette** , search for the Salesforce connector and drag **Query** operation.
  3. For the purpose of this demo, use the following query to get the contact from Salesforce.
```
SELECT firstName, LastName, Id,
	CAQH_Provider_ID__c,
	SF_Provider_ID__c,
	CAQH_organization_id__c,
	Provider_name__c,
	caqh_batch_id__c
from CONTACT
where name = ':name'
```

  4. Select and drag Transform Message at the flow on the canvas to prepare the input for the CAQH connector.
```
output application/java
---
 [{
 "caqh_provider_id": payload[0].CAQH_Provider_ID__c,
 "organization_id": payload[0].CAQH_organization_id__c,
 "po_provider_id": payload[0].Id,
 "last_recredential_date": "",
 "next_recredential_date": "05/05/2019",
 "delegation_flag": "Y",
 "application_type": "A",
 "affiliation_flag": ""
}]
```

  5. Use the `Update Providers - ProView (PUT)` connector operation after the listener, and select the connector configuration that you created.
  6. Set the **General** section in the connector configuration to `payload`.
  7. Set the **Target Value** in the Advanced section to `#[payload]`.
  8. Use another Transform Message component to add minimum 1 minute of wait time because it takes a few minutes to update the provider in CAQH.
```
%dw 2.0
import * from dw::Runtime
output application/json
---
 payload
wait 60000
```

  9. To check whether the update request was successful, drag `Get Status - Update to Roster` operation after the **Transform Message**.
  10. In the **General** section of the operation configuration,
    1. Set the **Batch_id** to `#[payload.batch_Id]`.
    2. Set **Target Value** in the Advanced section to `#[payload]`.
  11. Add a Transform Message component at the end of the flow to transform the output message to JSON format. Set the output of the Transform Message to,
```
%dw 2.0
output application/json
---
payload
```

  12. Run the application and point your browser to `http://localhost:8081/update-provider`.
5. Use the `Update Providers - ProView (PUT)` connector operation after the listener, and select the connector configuration that you created.
  6. Set the **General** section in the connector configuration to `payload`.
  7. Set the **Target Value** in the Advanced section to `#[payload]`.
  8. Use another Transform Message component to add minimum 1 minute of wait time because it takes a few minutes to update the provider in CAQH.
```
%dw 2.0
import * from dw::Runtime
output application/json
---
 payload
wait 60000
```

  9. To check whether the update request was successful, drag `Get Status - Update to Roster` operation after the **Transform Message**.
  10. In the **General** section of the operation configuration,
    1. Set the **Batch_id** to `#[payload.batch_Id]`.
    2. Set **Target Value** in the Advanced section to `#[payload]`.
  11. Add a Transform Message component at the end of the flow to transform the output message to JSON format. Set the output of the Transform Message to,
```
%dw 2.0
output application/json
---
payload
```

  12. Run the application and point your browser to `http://localhost:8081/update-provider`.


### Delete a Provider from Roster Using ProView
In this example, a Mule application queries Salesforce contacts to find a provider. It then deletes the provider in CAQH using the ProView API and gets the status of the delete request.
The delete request sets the provider status in CAQH to `Inactive`.   
---  
The process of implementing this flow is similar to updating a provider, except you use the **Delete Providers - ProView (PUT)** and **Get Status - Delete** from Roster operations
## Use Cases: XML
### Update a Provider from Salesforce to CAQH Using ProView
```
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:caqh="http://www.mulesoft.org/schema/mule/caqh"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	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/http
	http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
	http://www.mulesoft.org/schema/mule/caqh
	http://www.mulesoft.org/schema/mule/caqh/current/mule-caqh.xsd
	http://www.mulesoft.org/schema/mule/ee/core
	http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
  <flow name="UPDATE_PROVIDER_SALESFORCE_TO_CAQH">
    <http:listener
		doc:name="update-provider"
		config-ref="HTTP_Listener_config1"
		path="/UpdateProviderFlow"/>
    <salesforce:query doc:name="Query Salesforce Contact" config-ref="Salesforce_Config">
      <salesforce:salesforce-query >SELECT firstName, LastName, Id,CAQH_Provider_ID__c,SF_Provider_ID__c,CAQH_organization_id__c,Provider_name__c,caqh_batch_id__c from CONTACT where name = ':name'
      </salesforce:salesforce-query>
      <salesforce:parameters ><![CDATA[#[output application/java
---
{
	name : "kiuwxinj xwehonru"
}]]]></salesforce:parameters>
    </salesforce:query>
    <ee:transform doc:name="">
      <ee:message >
        <ee:set-payload ><![CDATA[output application/java
---
 [{
 "caqh_provider_id": payload[0].CAQH_Provider_ID__c,
 "organization_id": payload[0].CAQH_organization_id__c,
 "po_provider_id": payload[0].Id,
 "last_recredential_date": "",
 "next_recredential_date": "05/05/2019",
 "delegation_flag": "Y",
 "application_type": "A",
 "affiliation_flag": ""
}]
 ]]>        </ee:set-payload>
      </ee:message>
    </ee:transform>
    <caqh:update-to-roster-request-pv-by-put-request
	doc:name="Update Providers to Roster - Proview"
	config-ref="CAQH_Config1">
    </caqh:update-to-roster-request-pv-by-put-request>
    <ee:transform doc:name="Wait for 1 Minute">
      <ee:message >
        <ee:set-payload ><![CDATA[%dw 2.0
import * from dw::Runtime
output application/json
---
 payload
wait 60000]]></ee:set-payload>
      </ee:message>
    </ee:transform>
    <caqh:get-result-of-update-request
		doc:name="Get status of update to roster request"
		config-ref="CAQH_Config1"
		batch_id="#[payload.batch_Id]" />
    <ee:transform doc:name="Transform CAQH response to JSON">
      <ee:message >
        <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
      </ee:message>
    </ee:transform>
  </flow>
</mule>
```

### Delete a Provider from Roster Using ProView
```
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:caqh="http://www.mulesoft.org/schema/mule/caqh"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	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/http
	http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
	http://www.mulesoft.org/schema/mule/caqh
	http://www.mulesoft.org/schema/mule/caqh/current/mule-caqh.xsd
	http://www.mulesoft.org/schema/mule/ee/core
	http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
  <flow name="DELETE_SALESFORCE_PROVIDER_FROM_ROSTER">
    <http:listener
		doc:name="Listener"
		config-ref="HTTP_Listener_config1"
		path="/deleteProviderFlow"/>
    <salesforce:query
		doc:name="Query Salesforce Contacts"
		config-ref="Salesforce_Config">
      <salesforce:salesforce-query >SELECT firstName, LastName, Id,CAQH_Provider_ID__c,SF_Provider_ID__c,CAQH_organization_id__c,Provider_name__c,caqh_batch_id__c from CONTACT where name = ':name'</salesforce:salesforce-query>
      <salesforce:parameters ><![CDATA[#[output application/java
---
{
	name : "kiuwxinj xwehonru"
}]]]></salesforce:parameters>
    </salesforce:query>
    <ee:transform doc:name="Mapping from Salesforce to CAQH">
      <ee:message >
        <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
 [{
	"caqh_provider_id": payload[0].CAQH_Provider_ID__c,
	"organization_id": payload[0].CAQH_organization_id__c
}]]]></ee:set-payload>
      </ee:message>
    </ee:transform>
    <caqh:delete-from-roster-request-pv
		doc:name="Delete provider from roster using ProView"
		config-ref="CAQH_Config1">
    </caqh:delete-from-roster-request-pv>
    <ee:transform doc:name="Wait for 1 Minute">
      <ee:message >
        <ee:set-payload ><![CDATA[%dw 2.0
import * from dw::Runtime
output application/json
---
 payload
wait 60000]]></ee:set-payload>
      </ee:message>
    </ee:transform>
    <caqh:get-result-of-delete-request
		doc:name="Get status of delete from roster request"
		config-ref="CAQH_Config1"
		batch_id="#[payload.batch_Id]" />
    <ee:transform doc:name="Transform CAQH response to JSON">
      <ee:message >
        <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
      </ee:message>
    </ee:transform>
  </flow>
</mule>
```

## See Also
  * MuleSoft Help Center
  *