Integrating Bullhorn CRM into Microsoft Power Automate

In this guide, we will be uncovering how to integrate into Bullhorn via Microsoft Power Automate. We will cover various areas within the Bullhorn integration. Covering their two API types, SOAP and REST and the key differences between these from a Power Automate perspective, how to pull values from Bullhorn, practices to have recurrences across a period of time and more.

Bullhorn and Power Automate: Why Integrate: 

Bullhorn is a CRM predominately used for recruitment agencies, with an automation add-on that can be pricey and also, not allow for integration with third-party solutions too easily.

As a result, getting your Bullhorn CRM data into Microsoft Power Automate could be desirable.

You can find a variety of use cases that we would recommend for an integration here.

SOAP and REST: What are the key differences?

Before you start setting up your Power Automate instance, you will want to set up your API(s) with Bullhorn.

There are various differences with SOAP and REST API's that Bullhorn use, with pros and cons being experienced in both! As a result, we recommend setting up both SOAP and RESTAPI with Bullhorn initially so that you have the ability to utilise different types based on your requirements.

Comparison of SOAP and REST API's in Bullhorn

As you can see above, the REST API is more difficult to set up, but offers greater benefits. So, for quick and more standard API calls, as SOAP API call can be beneficial. Whereas a REST is useful for more complex calls. Note - Bullhorn do state that they recommend using a REST API.

Connecting Bullhorn to Power Automate

As noted above, there are different ways in which you connect your Power Automate environment to Bullhorn. For a SOAP API, you simply require your API Username, Password and Key. Whereas for a REST API, you will need to get your refresh token. This is done via POSTMAN & web browser (cannot be accessed via Power Automate). Further details are provided here - https://bullhorn.github.io/docs/oauth/

Setting up your Power Automate environment

Now that you have all of the connection details for your Power Automate flow, you can begin setting up the environment.

SOAP

For our SOAP example, we are going to run a query to get a placement reference.

Create your Microsoft Power Automate Flow

Create the trigger you would like.

Create a HTTP Request to get a Session ID

Your session ID request will only be required once at the start of your flow, but will be required for the pulling the entity references within Bullhorn. The details for setting up a HTTP Session are provided below. The only details that you will need to change within the URI are your location (i.e. EMEA) and within the body, you will need to change the API Username, Password and Key. You will receive these from your Bullhorn support contact.

The Bullhorn HTTP Session Pull

Once you have done this, you will need to pull the sessionID. To do this, we use a compose action and put in the following xpath expression:

xpath(xml(outputs('HTTPSession')['body']), 'string(//session/text())')

Create a HTTP Request to get an entityReference

Now that you have your session ID, you can begin pulling the entities. As listed in the entityReference documentation.

We have provided an example HTTP request for a placement. Here, we pass the sessionID that we composed before, and have referenced the placement reference. Note, in his case, we have also filtered the placement by ID.

A placement request that pulls the placement entity based on a placement ID

Run your flow!

Now, if your API was configured correctly, the flow should run successfully provide the fields related to your placement request. Details can then be pulled utilising an xpath expression.

first(xpath(xml(outputs('HTTPPlacement')['body']), '//*[local-name()="candidateID"]/text()')  ) 

Within the above expression, you can pull any fields from the output into power automate. If you would like to change what fields you pull, you just change the field that is referenced in bold. All field names are provided in your Admin "Field Mappings" page, or, on the entityReference documentation.

It is worth noting, Bullhorn's API is created for a request to be made per entity. As a result, if you want to run an API call to more than one entity, you will need to do an extra HTTP request. All of Bullhorn's entity references can be found here. As an example, if you want to carry out a GET request to a candidate, you simply change the value between entityReference to be the relevant entity. Be careful regarding case sensitivity and ensure you have cross-referenced any fields with the entity reference documentation.

REST

Create your Microsoft Power Automate Flow

Create the trigger you would like

Establish a way to manage and handle refresh tokens

As your refresh token only lasts for 30minutes until it expires. You will need to find a way to handle and manage your Refresh Token, so that everytime your flow runs, it has a fresher refresh token. A simple example of this (though you may want something more secure), would be through adding a refresh token to an Excel document, and whenever the refresh token has been used. Updating the refresh token with the new refresh token. This can all be handled via Power Automate. The logic behind this is shown below, with the HTTP request for getting a new refresh token. (As under "Connecting Bullhorn to Power Automate", you will require an initial refresh token from POSTMAN to kick this off).

Logic for capturing and updating your refresh token

Create a HTTP request to get Bullhorn REST Token

With every Bullhorn REST API pull, you will need to put a Bullhorn token into the header of the HTTP request. To do this, use the HTTP request in which you got your new refresh token, and pull an access token. This is then utilised for the URI of the REST HTTP request.

Getting your Bullhorn token.

Create a HTTP request to get an entityReference

Now that you have the BhRestToken, you can utilise this for any REST pull to get entity fields. In the below example, I am pulling a customObject from Bullhorn related to placements. This is something that a SOAP does not accommodate. Our fields are "id", "text2", "float1" and "text5".

Pulling the Bullhorn REST data utilising a BhRestToken

Run your flow!

Once this has been set up, you are in! As your flow runs either in real-time, or with test flow runs, you will see the HTTP output request providing all of the fields associated with that entity.

A REST API is slightly more convoluted to pull the data from a HTTP output than that of a SOAP API, due to the data being in JSON. As a result, you will need to parse the JSON and then use the action "Select" to make the data in a readable format.

Utilising Parse JSON and Select to get REST Details

Best Practice: 

1) ensure that your data is in the right format (i.e. often times when pulling the data, is formats it in a string, ensure that if you are doing anything that requires the output to be an integer/float, that you handle this as so).

2) if you are using multiple private labels in your bullhorn instance, for simplicity in the future, try and use the same custom fields where there are similarities.

Start the conversation

No matter where you are on your journey, we're eager to help you untangle your challenge and find you a route forwards.

Responsive
Always happy to help