Use Case - Looking Up Caller Information in HubSpot

Look up caller information in HubSpot, create a link to the HubSpot contact and show it in Nimbus.

In this use case, we're going to create a connection to HubSpot CRM:

  • We want to look up the Nimbus caller phone number in HubSpot and show the caller information in Nimbus.
  • We also want to create a link to the HubSpot contact and show it in Nimbus.
  • 💡 There is a Power Automate Connector for HubSpot, but it does not allow for a contact search in the HubSpot CRM. Instead we're going to use the HTTP Element to query the CRM API | Search (hubspot.com).

Overview of the flow

 
 

PRECONDITIONS

You require  service owner rights to to create the flow. 

  • A Nimbus service must already be set up.
  • You need a valid HubSpot CRM URL and account.

🔍 Note: You can create a developer instance for HubSpot on HubSpot Developer Site.

 Show Icon Legend
 

Create an Application in HubSpot

🔍 In this step we want to create an API key so that we can authenticate on the HubSpot CRM API using an API key.

  1. In your HubSpot instance, create a private application. We named it "Luware Nimbus Power Automate".
  2. Generate an API token. It should look like this:

✅ Note down the access token. In the next step we want to create the flow and use this token in the query of the Power Automate HTTP Element, by setting the headers to:

CODE
headers: {
 'Authorization': `Bearer ${YOUR_TOKEN}`,
 'Content-Type': 'application/json'
 }

Create the Power Automate Flow

✅ Start with a blank Cloud Flow.

1. Add the Nimbus "GetOnNewTasks" to trigger the flow. 

Select the service(s) that you want to listen to.

2. Add an "Initialize Variable" element to the flow for the ApiKey and copy your Access token as value into it.

3. Add a "HTTPElement" to the flow and rename it to "Contact Search". Fill out the item as shown below.

The body part consists of

  • filterGroups: allow to filter on properties.
  • properties: defines which fields we want to return in the response.

💡 You can omit the "properties" section to return the default fields. Please read the HubSpot documentation to get further information.

If you want to search in all default fields you can simplify the body part using:

CODE
{ "q": "@{triggerOutputs()?['body/microsoftCallerId']}" }

Parameters:

Body:

CODE
{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "phone",
 "operator": "EQ",
 "value": "@{triggerOutputs()?['body/microsoftCallerId']}"
 }
 ]
 }
 ],
 "properties": [
 "firstname",
 "lastname",
 "phone",
 "mobilephone",
 "company",
 "email",
 "jobtitle",
 "hs_contact_id"
 ]
}

4. At this point you can already test your flow and should get a valid response if the phone number was found at a HubSpot contact. A valid response would look like:

CODE
{
 "total": 1,
 "results": [
 {
 "id": "51",
 "properties": {
 "createdate": "2022-07-21T12:32:03.719Z",
 "email": "bh@hubspot.com",
 "firstname": "Brian",
 "hs_object_id": "51",
 "lastmodifieddate": "2022-07-21T13:15:53.545Z",
 "lastname": "Halligan (Sample Contact)"
 },
 "createdAt": "2022-07-21T12:32:03.719Z",
 "updatedAt": "2022-07-21T13:15:53.545Z",
 "archived": false
 }
 ]
}

Update the Nimbus Task

✅ Now we save the results of the search query.

  1. Add a "Compose" Element to the flow.
    • TitleFirstResult
    • Inputsbody('Contact_Search')?['results']
  2. Add an "UpdateTask" Nimbus element to the flow and update the items with the result from the Compose object accordingly.

Parameters

  • RequestId = trigger RequestId
  • Customer.FirstName = outputs('FirstResult')?[0]['properties']['firstname']
  • Customer.LastName = outputs('FirstResult')?[0]['properties']['lastname']
  • Customer.Company = outputs('FirstResult')?[0]['properties']['company']
  • Customer.JobTitleoutputs('FirstResult')?[0]['properties']['jobtitle']
  • Customer.PrimaryTelNumber outputs('FirstResult')?[0]['properties']['phone']
  • Customer.TelNumbers:
    • Office Phone = outputs('FirstResult')?[0]['properties']['phone']
    • Mobile Phone = outputs('FirstResult')?[0]['properties']['mobilephone']
  •  Customer.Customfields:
    • HubSpotId = outputs('FirstResult')?[0]['id']
    • HubSpotUrl = concat('https://app-eu1.hubspot.com/contacts/<your instance id>/contact/', outputs('FirstResult')?[0]['id'])

Configure in Nimbus

✅ Now that we have all the data we want to create a custom context.

  1. Create the context in the Nimbus configuration. 💡 Ensure that the Organization Unit of this context item is matching to your service so you can select it later.
  2. Assign your context in the Service Settings > "Context" tab.
  3. Open Nimbus portal in your browser and make a test call to your service to check if the context is now opening correctly.

Table of Contents