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

In this use case we assume that you've already created a Nimbus service. 

Enterprise Routing Your service needs to have a Enterprise Routing service license assigned to be able to use the advanced Nimbus Features such as the Conversation Context, Parameters and the Nimbus Power Automate Connector.

Additionally, ensure to read and follow the Nimbus Power Automate Connector preconditions, as this Use Case will make use of Nimbus Trigger Events  and Flow Actions.

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.

 

INC Icon Legend Accordion

Show Icon Legend

💡 = A hint to signal learnings, improvements or useful information in context. 🔍 = Info points out essential notes or related page in context.
☝ = Notifies you about fallacies and tricky parts that help avoid problems. đŸ€” = Asks and answers common questions and troubleshooting points.
❌ = Warns you of actions with irreversible / data-destructive consequence. ✅ = Intructs you to perform a certain (prerequired) action to complete a related step.
 
 

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'
 }

Start Flow

  1. Go to the Flow landing page.
  2. Go to "My Flows".
  3. Click "+ New Flow" and create a blank "Automated Cloud Flow".
  4. Give your new flow a meaningful name, e.g. "Get Caller Information from HubSpot".
  5. In the text box underneath, search for “Nimbus” and choose the “When a task changes state” trigger.
  6. Click the Create button.
  7. Select the “When a task changes state” trigger.
  8. In the “Services Item” dropdown, select the Nimbus service's UPN.
    💡 You can also get the data of multiple services at this point, but for the sake of simplicity we keep it to one service in this example.
  9.  In the “Task Events” dropdown select “System Accepted”.
  10. In the “Advanced parameters” dropdown enable “Modalities” and "Directions".
  11. In the “Modalities Item” dropdown select “Audio”.
  12. In the “Directions Item” dropdown select “Inbound”.

Initialize Variable

  1. In the editing area click to add a new action.
  2. Search for "variable" and select “Initialize variable” under the “Variable” section.
  3. Configure the action as follows:
Field Value to fill in / 🌟 = Nimbus dynamic content 
Name APIKey
Type String
Value Paste your Access token into this field.
  1. In the editing area click to add a new action.
  1. Search for "variable" and select “Initialize variable” under the “Variable” section.
  2. Configure the action as follows:
Field Value to fill in / 🌟 = Nimbus dynamic content 
Name HubspotBaseContactUrl
Type String
Value https://app-eu1.hubspot.com/contacts/<your instance id>/contact/

Retrieve Caller Information via HTTP Request

  1. In the editing area click to add a new action.
  2. Search for "HTTP" and select “HTTP” under the “HTTP” section.
  3. Configure the action as follows:
Field Value to fill in / 🌟 = Nimbus dynamic content 
URI https://api.hubapi.com/crm/v3/objects/contacts/search
Method POST
Headers

Enter the following key/value pair:

Key
Value
Authorization Bearer @{variables('APIKey')}
Content-Type application/json
Body

The body part consists of

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

Paste the following code into the body:

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

💡 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']}" }

 

💡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
 }
 ]
}

Saving the results of the query

  1. In the editing area click to add a new action.
  2. Search for "Data operation compose" and select “Compose” under the “Data operation” section.
  3. Configure the action as follows:
Field Value to fill in / 🌟 = Nimbus dynamic content 
Inputs
body('HTTP')?['results']

Update the Nimbus task

  1. In the editing area click to add a new action.
  2. Search for "Nimbus" and select “Update task” under the “Luware Nimbus” section.
  3. Configure the action as follows:
Field Value to fill in / 🌟 = Nimbus dynamic content
Task ID 🌟 Task ID
Customer First Name
outputs('Compose')?[0]['properties']['firstname']
Customer Last Name
outputs('Compose')?[0]['properties']['lastname']
Customer Display Name
@{outputs('Compose')?[0]['properties']['firstname']} @{outputs('Compose')?[0]['properties']['lastname']}
Customer Company
outputs('Compose')?[0]['properties']['company']
Customer Job Title
outputs('Compose')?[0]['properties']['jobtitle']
Customer Primary Telephone Number
outputs('Compose')?[0]['properties']['phone']
Telephone Numbers

Click on to and add

[
    {
        "name": "Office Phone",
        "value": @{outputs('Compose')?[0]['properties']['phone']}
    },
    {
        "name": "Mobile Phone",
        "value": @{outputs('Compose')?[0]['properties']['mobilephone']}
    }
]
Custom Context Parameters

 

Click on to and add

[
    {
        "name": "HubSpotId",
        "value": @{outputs('Compose')?[0]['id']}
    },
    {
        "name": "HubSpotUrl",
        "value": @{concat(variables('HubspotBaseContactUrl'), outputs('Compose')?[0]['id'])}
    }
]

Make sure to replace <your instance id> in the above expression with the ID of your HubSpot instance.

 

 

Configure in Nimbus

✅ Now that we have all the data we want to create a Conversation Context item with a Parameter as a placeholder. 

  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