HubSpot integration with Ory Actions
HubSpot is an inbound marketing, sales, and customer service platform. It provides a suite of tools and services that allow businesses to manage and optimize their online presence, including website content, email marketing, social media, lead generation, and analytics. HubSpot's platform is designed to be a one-stop-shop for businesses to manage their marketing and sales efforts, and the platform integrates with a variety of third-party tools and services to provide a comprehensive and seamless experience for users. Ory can synchronize user data with HubSpot via the HubSpot contact list API.
To integrate HubSpot using Ory Actions, you must complete these steps:
- Create a HubSpot account and set up the necessary contact lists for your customer data.
- Create a private app access token in HubSpot.
- In your Ory Network project, set up an Ory Action trigger that will send data to the HubSpot destination when a specific event occurs, for example on successful registration.
- Test the integration to ensure that data is routed correctly from your application to HubSpot.
Configuration
Not sure what Jsonnet is? Read the Ory Actions webhook guide.
First, create a Jsonnet file. It transforms the identity data from Ory to a format Hubspot understands:
./hubspot_identify.jsonnetfunction(ctx) {
properties: {
email: ctx.identity.traits.email,
firstname: ctx.identity.traits.name,
// ...
},
}To use this Jsonnet snippet, encode it to Base64 and save it to the clipboard:
cat hubspot_identify.jsonnet | base64 | pbcopy
Next, define the Ory Action as a JSON Object. Remember to replace the placeholders with your data.
./webhook-action.json{
"hook": "web_hook",
"config": {
"response": {
"ignore": true
},
"auth": {
"type": "api_key",
"config": {
"name": "Authorization",
"value": "Bearer {YOUR_API_KEY_HERE}",
"in": "header"
}
},
"url": "https://api.hubapi.com/crm/v3/objects/contacts",
"method": "POST",
"body": "base64://{ENCODED_JSONNET}"
}
}Finally, add this action to your Ory Network Project using the Ory CLI.
You can trigger this webhook after successful registration:
ory patch identity-config {project-id} \
--add "/selfservice/flows/registration/after/hooks/0=$(cat webhook-action.json)" \
--format yamlAlternatively, you can trigger this action only when the user signs up with a password or social sign-in:
ory patch identity-config {project-id} \
--add "/selfservice/flows/registration/after/password/hooks/0=$(cat webhook-action.json)" \
--format yaml