Simple (I think) requirement for CRM Extensions API

contacts

#1

Hi there. I'm new to this forum so bear with my ignorance of the Hubspot API.....

I have what I think is a simple requirement; I would like to present an extra option to the user whenever he/she clicks the Actions drop-down for any contact.

The option will be called "Add A Quote", and the action of the click will be to open a pop-window which will show the Add Quote option from another CRM system. No POSTed variables, nothing fancy, just a URL that opens in a pop-up window.

What's the most effective way to do this? I have read the documentation about the CRM Extensions API, so I think that's the way forward, but that's as far as I've got at the moment.

I'm fairly experienced in API coding to push and pull data between systems but this is a new area for me.

Any suggestions gratefully received.


#2

One thing that would be useful is a sample of the code that is shown in https://developers.hubspot.com/docs/methods/crm-extensions/crm-extensions-overview


#3

We want to "surface" a link to our Customer Portal application using the CRM Extensions API.
Ideally this link should be in the Actions drop down list below the contact name, although it would also be acceptable to locate it on the sidebar, as long as it is the next card after the contact name.

The card or action should simply be a link with the text, ”Add a Quote”, and clicking on that link will trigger a process.

The process will be:

  1. Check if the customer (Company) exists on our Customer Portal. If not, add the company by calling an API (I would expect to see a screen throbber whilst the add company is processing):

POST /customers/ HTTP/1.1
Accept: application/vnd.xtrf-v1+json{
"name": "Jan",
"fullName": "Kowalski",
"contact": {
"emails": {
"primary": "email@email.org"
}
},
"billingAddress": {
"addressLine1": "Cracow address 1",
"city": "Cracow",
"countryId": 100
}
}

  1. Check if the contact (person) exists on our Customer Portal. If not, add the contact by calling an API (I would expect to see a screen throbber whilst the add contact is processing):
    POST /customers/persons/ HTTP/1.1
    Accept: application/vnd.xtrf-v1+json{
    "name": "Nowy",
    "customerId": 111,
    "contact": {
    "emails": {
    "primary": "nowy@person.org"
    }
    }
    }

  2. Then, with the customer and contact defined, open a pop-up window into the Customer Portal and display the Add Quote screen:

Our Sales staff can then follow their internal procedures to add the quote to our Customer Portal.

  1. Once the quote has been completed, the pop-up window can be closed and focus will return to the Hubspot contact screen. A background process will be triggered on completion of the quote which will add a corresponding deal to Hubspot.

#5

Hi @mike.mackechnie, These functionalities should exist. Action hook actions are what you'll want to send your POST requests: https://developers.hubspot.com/docs/methods/crm-extensions/crm-extensions-overview#action-hook-actions. For the popup screen via iFrame, you can set that with an action type: https://developers.hubspot.com/docs/methods/crm-extensions/crm-extensions-overview#action-types. Here's a very simple (static) example: https://obscure-cliffs-47038.herokuapp.com/ - and what it looks like in HubSpot:


#6

Thanks for this Connor.

Forgive my ignorance, but where do you code this action? I think I can figure out the JSON I need to code, but I don't see how I code the POST request.

I have a developer account, and I have created a public app called Hubspot XTRF API(https://app.hubspot.com/developer/4638459/application/176110), but I don't see anywhere to actually write the code and I don't know how to integrate that into the live application once it has been tested.

Sorry but I think I'm going to need some hand-holding with this.


#7

Hey @mike.mackechnie, you'd code this wherever you application (i.e. the actual code that makes your app run is deployed). No code is actually written from within the developer account. For example, I pushed my code here up to heroku, so that's where my code lives. An example way to POST data would be to have this structure returned and ready to use when you load up a contact company or deal:

{
  "type": "ACTION_HOOK",
  "httpMethod": "POST",
  "uri": "https://example.com/action-hook",
  "label": "Example action",
  "associatedObjectProperties": [
    "some_crm_property"
  ]
}

You'd handle your POST and GET routes from within your application, wherever it may be hosted, and format the JSON in the above way so that any time your specified objects from your dev account are loaded, the request URL defined in the settings is requested, and those actions defined within your application are then available to use. Here are a few examples of how my dev account settings looks: