<aside>
Prerequisites:
Custom Webhooks are available in the Professional and Enterprise tiers of the Hubspot Marketing Hub, Sales Hub and Service Hub.
Custom Code in Workflows are available in the Professional and Enterprise tiers of the Hubspot Operations Hub.
A Project needs to be created in Seen Platform prior to setting up the integration.
</aside>
Create a new Workflow in Hubspot to send data to Seen
Define your enrolment trigger for the Workflow. This decides who will be sent to Seen and when.
Add a new step: Custom code

<aside>
In this example we use Node.js 20.x as the Language.
</aside>
Create your Secret - more information here
<aside>
In this example we use the API Token option
</aside>
You can use the code below as a starting point:
const axios = require('axios');
// This is the correct structure of the main function, accepting event and callback
exports.main = async (event, callback) => {
// Access the input fields from the workflow's event object
const firstname = event.inputFields.firstname;
const lastname = event.inputFields.lastname;
const crm_id = event.inputFields.hs_object_id; // Use HubSpot Contact ID as crm_id
// Create the Seen API payload
const SeenApiPayload =
{
first_name: firstname,
last_name: lastname,
crm_id: crm_id // Use HubSpot Contact ID as crm_id
};
// Define the Seen API endpoint and API key
const SeenApiUrl = '<https://next.seen.io/v1/projects/{{project_id}>}/data'; // Replace with the actual endpoint
const apiKey = process.env.ACCESS_TOKEN; // Securely retrieve your API key from HubSpot secrets
// Make the API request
try {
const response = await axios.post(SeenApiUrl, SeenApiPayload, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
// Check if the response status is not in the success range
if (response.status < 200 || response.status >= 300) {
throw new Error(`API responded with status code: ${response.status}`);
}
// Log the success response
console.log('Seen API Response:', response.data);
callback({ outputFields: { hs_execution_state: "SUCCESS" } });
} catch (error) {
console.error('Error sending data to Seen API:', error.response ? error.response.data : error.message);
// Set the workflow output to indicate failure
callback({ outputFields: { hs_execution_state: "FAILURE", error_message: error.message } });
}
};
<aside>
Create new Contact Property fields for “Seen player URL” and “Seen Email Thumbnail URL”. These are the two properties we will be using in this example.
Create a new Workflow to receive data from Seen.
Choose “When a webhook is received” under “Advanced options”
Create a Webhook Event, and finish the setup by following these steps:
{
"crm_id": "12345",
"seen_player_url": "<https://player.Seen.io/v/yQJfUuCG3uMJc3YrGmzB>",
"email_thumbnail_url": "<https://storage.googleapis.com/output-artifacts-prod/41769660-ab12-4cd5-8328-1cb3e1bea334/outputs/7d124bf9a700d98cc76aae46798fa82d75d83480228614b486daa62bc38b378d/email_thumbnail.jpg>"
}
Create a new step: “Set property value” under the “CRM” menu.
Create a new step: “Set property value” under the “CRM” menu.
Navigate to your Project in Seen Platform
<aside>
This example uses a crm_id - custom property for the unique IDs for Seen Platform.
More information about ID handling in the Seen Platform available here.
</aside>
You can now test the full integration flow.