For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
SupportDashboard
Getting StartedAPI ReferenceRoadmapBlog
Getting StartedAPI ReferenceRoadmapBlog
  • Getting Started
    • Overview
    • What is Schematic?
    • Concepts
  • Using Schematic
    • Who Uses Schematic
  • Quickstart
    • Quickstart
    • Account Setup
    • Entitling a Feature
    • Tracking Usage
    • Components
    • Identifying Users
    • Setup the SDK
  • Using Feature Flags
    • Overview
    • Flags
    • Features
    • Tracking Feature Usage
    • Company Overrides
    • Feature Types
  • Building Your Catalog
    • Overview
    • Plans
    • Managing Company Plans
    • Configuring the Catalog
    • Add Ons
    • Trials
  • AI Tooling
    • For Developers
  • Setting Up Billing
    • Overview
    • Usage Based Billing Models
    • Seat Based Billing Models
    • Credit burndown
  • Using UI Components
    • Overview
  • Developer Resources
    • Concepts
    • Key Management
    • Environments
    • Entity Relationship Diagram
  • Production Readiness
    • Availability
    • Observability & Support
    • Security
  • Integrations
    • Segment Integration
    • Clerk Integration
    • WorkOS Integration
    • Salesforce Integration
    • Hubspot Integration
  • Playbooks
    • Overview
    • Creating a metered feature
    • Backfills and usage corrections
    • Rolling out beta functionality with Flags
    • Handling customer exceptions and feature trials
    • Automatically provision customers using Stripe
    • Build a slack webhook
LogoLogo
SupportDashboard
On this page
  • Create a Workflow
  • Configure a custom code action
  • Test connection with Schematic
Integrations

Hubspot Integration

Was this page helpful?
Previous

Webhooks

Next
Built with

The following guide walks through how to set up a Hubspot Workflow to communicate with the Schematic API in order to:

  • Create new companies or users
  • Create and update company or user traits

Create a Workflow

Navigate to Automations and select Workflows. In the Create Workflow dropwdown select From scratch.

Create a blank workflow that is Company based.

Configure a custom code action

Click the + sign to add an action. Select Data ops and Custom code to create a new action.

Make sure Python 3.9 is selected as the language for this guide. In the Secrets dropdown, select Add secret.

Name the secret SCH_SECRET, and, in another tab, get your secret key from Schematic.

Map the Record ID, Company Name, and Company Domain to properties within the action.

Copy the code below into the Code section to communicate with the Schematic /companies endpoint.

import os
import requests
import json
def main(event):
url = 'https://api.schematichq.com/companies'
company_body_payload = {"keys": {"id": event.get('inputFields').get('hs_object_id') },"name": event.get('inputFields').get('name'),"traits": {"website": event.get('inputFields').get('domain')}}
print(company_body_payload)
headers = {"X-Schematic-Api-Key":os.getenv('SCH_SECRET'), "Content-Type": "application/json"}
# Request
api_response = requests.post(url, data=json.dumps(company_body_payload), headers=headers)
output = json.loads(api_response.text)
print (output)
# Return the output data that can be used in later actions in your workflow.
return {
"outputFields": {
}
}

Test connection with Schematic

Once the action is configured, expand the Test action section, select a company, then click Test.

If the call is successful, Hubspot should show a Success status and the response from Schematic.

You can also check Schematic to ensure the company was created.

If the API call is working as expected, we can now customize the flow in a variety of ways to retrieve additional values from Hubspot, to trigger based on activity (e.g. a closed won deal), or to generate requests against other Schematic endpoints (e.g. /users).