NEW: we have a free HubSpot app that you can use

You can easily install the HubSpot app directly from our portal:

  • Log in to

  • Go to Integrate > Integrations > HubSpot and click Install

If you do not want to use the app, your HubSpot account must meet the following condition:

  • You must have access to the Workflow builder under the "automate" heading in the HubSpot dashboard.

This article will explain how to implement in your HubSpot workflows. In doing so, the following steps will be explained:

  1. Creating a HubSpot workflow;

  2. Linking the API Key to HubSpot;

  3. Adding a action to the workflow;

  4. Testing the action.

Linking with HubSpot can be done in Javascript (NodeJS) and Python. These are flexible programming languages supported by HubSpot. In this example, only Javascript will be used.

Links to consult

1. Creating a HubSpot workflow

Go to your HubSpot dashboard and click on "Automation" -> "Workflows" at the top of the menu. From there, click on "Create workflow" at the top right. Choose a template, or start from scratch.

In the workflow, click on the plus and in the menu that follows on "Custom code". See also the image below.

2. Linking the API Key to HubSpot

After creating the custom code action in the workflow, a menu appears on the right where the action can be edited. There, under "Secrets", click "Add secret", as shown in the image below.

In the pop-up, enter a name (letters and low dashes only) and a API key as the value. API keys can be found at

The API Key is now linked to HubSpot.

3. Adding a action to the workflow

Add properties

In the same menu, it is possible to add properties to the code action. To do so, click "Add property" and add all desired properties. To send cards to a person, it is important that at least the following data is known:

  • A name;

  • An address;

  • A postcode;

  • A city;

  • A country.

If these details are missing, a card may not arrive correctly to the recipient. See the image below for the data for this example.

Call with desired properties

To convert the desired data into a map, the code snippet below can be used. The code also includes comments with additional explanations. Don't forget to enter your own data in all fields.

HubSpot code for calling
const axios = require("axios");
// This function causes properties to start with a capital letter
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
exports.main = (event, callback) => {
// Import the data selected in the previous header.
const firstname = capitalizeFirstLetter(event.inputFields["firstname"]);
const lastname = capitalizeFirstLetter(event.inputFields["lastname"]);
const salutation = capitalizeFirstLetter(event.inputFields["salutation"]);
const animalname = capitalizeFirstLetter(event.inputFields["animalname"]);
const address = capitalizeFirstLetter(event.inputFields["address"]);
const zip = event.inputFields["zip"]; // The postal code does not need to start with a capital letter
const city = capitalizeFirstLetter(event.inputFields["city"]);
const country = capitalizeFirstLetter(event.inputFields["country"]);
sender: {
name: "Your company name",
address: "Your address",
postalCode: "Your postal code",
city: "Your city",
country: "Your country",
recipient: {
name: firstname + " " + lastname,
address: address,
postalCode: zip,
city: city,
country: country,
templateId: "<<Fill in the template ID here>>",
finish:"<<Fill in the desired finish here>>",
mergeVariables: {
// Use the desired merge variables in this section
Salutation: salutation,
Surname: lastname,
NameAnimal: animalname,
billingId: "<<Fill in a billing ID here (not required)>>"
headers: {
"x-api-key": process.env.Print_One_API_Key, // Did you give the API key a different name? If so, modify it here.
.then((result) => {
// The following code is executed when a map is successfully sent.
.catch((error) => {
// The following code is executed if something went wrong when sending a card.

Finally, click save to save the action.

4. Testing the workflow

Now that the action is finished, it can be tested. To do so, click on "Testing" in the workflow menu. Click on "Testing" in the menu of the action. Enter the data you want to use for testing and click "Test". If everything went well, the workflow will have been executed successfully and a card will have been sent to the specified data. The map will also show up in the dashboard.

Help, something isn't working!

Don't worry, when testing the action, a clear error message will appear, for example the one below. In that error message you can clearly see which template is not set correctly.

Example of error JSON Body
2 "statusCode": 400,
3 "message": [
4 "'tmpl_4fd010d-16d1-4bfb-b043-ae7f3520f3ea' does not exist.".
5 ]

Should you still encounter a problem, you can always consult HubSpot's documentation.