Connecting HubSpot to Nicoka

The HubSpot connector links your HubSpot portal to Nicoka both ways, each side for what it owns:

  • From HubSpot to Nicoka: a company or contact created in HubSpot is created in Nicoka if it does not exist there yet.
  • From Nicoka to HubSpot: a job created in Nicoka creates a deal in HubSpot with its line item, which the contract updates; each amendment creates its own deal, linked to the job's deal.

This article explains how to connect your portal, set up the field mapping, then trigger the sending of jobs and orders. These settings require Nicoka administration rights and administrator access to the HubSpot portal.

Step 1 – Create a private app in HubSpot

Nicoka connects to HubSpot with the token of a private app.

  1. In HubSpot, open Settings > Integrations > Private Apps (depending on your portal version: Development > Legacy Apps), then create an app.
  2. In the Scopes tab, select:
    • to receive companies and contacts: crm.objects.companies.read, crm.schemas.companies.read, crm.objects.contacts.read, crm.schemas.contacts.read;
    • to send jobs and orders: crm.objects.deals.read, crm.objects.deals.write, crm.schemas.deals.read, crm.objects.line_items.read, crm.objects.line_items.write, crm.schemas.line_items.read.
  3. In the Auth tab, copy the access token (it starts with pat-) and the client secret.

The schemas scopes are required: they let Nicoka list your portal's properties in the mapping tables.

Step 2 – Connect the portal in Nicoka

  1. In the side menu, open Customizing > Integrations.
  2. On the HubSpot card, CRM category, click Configure, or Add your account if a portal is already connected.
HubSpot tile of the Integrations screen with its Add your account button
  1. Click Connect a portal, enter a free portal name, the access token and the client secret, then click Save. The token is checked against HubSpot before saving: a rejected token creates no connection.

Once connected, the account's Configure button opens the configuration window. Saved tokens are never shown again: leave the field empty to keep them.

HubSpot portal configuration window: name, access token, client secret and webhook address

Step 3 – Receive companies and contacts

The configuration window has one section per record type. In the Accounts and Contacts sections:

  • Synchronization direction: choose HubSpot to Nicoka.
  • Type, Status, Source: the values given to the records created, which HubSpot does not carry.
  • The mapping table: for each row, the Nicoka field to fill and the HubSpot property that fills it. Tick Update so that the HubSpot value also refreshes a record that already exists. Without this box, the property is only read when the record is created: a later change made in HubSpot does not reach Nicoka. On a ticked row, HubSpot wins: a value changed in Nicoka is replaced by the HubSpot one the next time the record changes in HubSpot. For a list field, enter in Values the HubSpot value = Nicoka id mapping, for example Client=1, PROSPECT=2.
Accounts section: sync direction, default values and mapping table

To receive new records and changes as they happen, copy the address shown in the blue box of the configuration window. In HubSpot, open the Webhooks tab of your private app, paste this address and subscribe to four events:

  • Company – created and Contact – created: the record is created in Nicoka if it does not exist there yet;
  • Company – property changed and Contact – property changed: the fields ticked Update are refreshed. Only subscribe to the properties of your mapping table: HubSpot sends one event per changed property, and a property missing from the table is not read.

A change reaches Nicoka a few minutes after it is saved in HubSpot. After a bulk import or bulk update in HubSpot, arrivals are spread out: allow about one hour per 3,000 companies.

A contact whose company is not in Nicoka yet brings that company along.

Step 4 – Send jobs as deals

In the Jobs section:

  • Synchronization direction: choose Nicoka to HubSpot. As long as this setting stays on Do not synchronize, no deal is created.
  • Pipeline and stage of the created deals: where new deals appear in HubSpot.
  • Deal property carrying the job id: a HubSpot property dedicated to this use, which receives the job number. It prevents duplicates: if a deal already carrying this number exists in HubSpot, Nicoka takes it over instead of creating a second one.
  • The mapping table: which job field fills which deal property. Your custom fields are offered too, for example a margin rate.
Jobs section: Nicoka to HubSpot direction, pipeline and stage, job id property and mapping

In the tables of this section and the next one:

  • The Fixed value column sends a constant value without a Nicoka field (then leave Nicoka field empty), or acts as a default when the field is empty.
  • The Values column reads the other way round than for accounts: Nicoka id = HubSpot value, for example 1=Standard, 2=AO. A value missing from the table is not sent.

The deal is associated with the HubSpot company of the job's customer, and with its main contact if HubSpot knows it. A job whose customer is not linked to a HubSpot company creates no deal.

Step 5 – Send contracts and amendments

The deal of a job is created with one line item: the default article of the job type, set in the job types configuration. Without an article on the type, the deal is created without a line and the contract adds its own.

  • The contract of the job takes that line over: it writes its amount and number on it, without adding a second one. A second contract on the same job adds its own line.
  • An amendment creates its own deal, with its line item, associated with the company, the contact and the job's deal. It takes the information of the job's deal; its name and amount are the amendment's. An amendment to an amendment is also linked to the job's deal.
  • A changed order updates its line, and for an amendment its deal.

In the Orders section:

  • Synchronization direction: Nicoka to HubSpot.
  • Line item property carrying the order id: a line item property dedicated to this use, which receives the order number. It ties each line to its order; until it is chosen, no line is sent.
  • The first table: which order field fills which line item property, for example the total in Unit price and a fixed quantity of 1.
  • Deal fields updated by the order: what the order writes on the deal itself, for example a gross margin rate only known at signature.
Orders section: order id property, line item mapping and deal fields updated by the order

The line amount is computed by HubSpot from the price and quantity. The deal amount follows its lines if your HubSpot portal is set to compute it automatically.

Click Save to store the configuration.

Step 6 – Trigger the sending with events

Jobs and orders are sent when a Nicoka event fires: you choose when. Open Customizing > Admin, then Cross Application > Events, and create two events:

  1. On the Job entity, fired on creation and update: in the actions, choose the Integration type, then your HubSpot portal, then Sync the HubSpot deal. On creation the deal is created; on update only the mapped fields that just changed are sent.
  2. On the Order entity, fired on creation and update: Integration type, your portal, then Sync the HubSpot deal line item.

Your portal is only offered in the list when the Nicoka to HubSpot direction is set for that entity in step 4 or 5. For how events work in general, see Alerts and events.

Sending runs in the background, a few moments after saving: saving the job or the order never waits for HubSpot.

Open the deal from Nicoka

A job linked to a deal shows a HubSpot icon in its header, which opens the deal in your portal. Accounts and contacts coming from HubSpot show the same icon.

Good to know

  • A change made in HubSpot does not reach Nicoka? Check that the field's row is ticked Update and that your private app is subscribed to changes of that property. A box ticked later applies to the following changes: to bring the records already in Nicoka up to date, contact support.
  • No deal created? Check that the job's customer is linked to a HubSpot company, that the Nicoka to HubSpot direction is set on Jobs, and that the event is active.
  • Changing a job updates its deal, but only on the mapped fields that changed: the pipeline, the stage and properties edited by hand in HubSpot are not overwritten. Changes made to a deal in HubSpot do not come back to Nicoka.
  • Deleting an order does not delete its line in HubSpot.
  • Test portal and production portal: Nicoka records are linked to the companies of a single portal. Connect the portal your teams actually work in before turning on job sending.
Were this information helpful?

 Summary