CIAM by example in four recipes: Send data to marketing for personalization

This recipe is part of the series Learn CIAM by example: Four recipes to improve your app’s security and UX. You can learn more about the series by downloading our four recipes in a cookbook format.

In this recipe, you learn how to share identities with marketing tools — like your email mkt solution — for personalized user engagement.

As organizations grow, the number of touchpoints to perform audience outreach and activation becomes exponential.

Understanding the journey of an individual user across your different platforms and channels can be complicated, especially when you don't necessarily have a unified view of all your users.

Why is CIAM important for personalization?

CIAM helps understand how users are using your platform and services. By understanding when users last logged in and from where, or even assessing for inactivity, CIAM gives you data points your marketing and sales teams can use to promote engagement.

When your organization has CIAM, you can give your teams a better understanding of your audience, enabling personalization in many different ways — from your product’s user interface (UI) to marketing emails sent to your users to whether and how sales should perform outreach for conversion.

With a focus on Identity, you can ship insights from your user’s journey to apps, email, and marketing systems, enabling ultra-personalized messaging.

Phase 1: Ask for consent

When it comes to data privacy, CIAM helps draw a dotted line between the information your users consent to and the information you use for personalization, which is vital for regulations surrounding personalization programs.

Before you can collect information about your audience and pipeline, you’re going to need to ask for consent. 

Check out our recipe on data privacy compliance to learn how to add consent when someone signs up for your application.

Phase 2: Unify your customer database

With Auth0 by Okta, you can connect your Identity usage with your data lake or marketing automation system of choice, giving you a more complete profile of each customer and your audience as a whole. This data can be used in many different ways — from changing the UI and suggestions in your app to sharing information with marketing for targeted emails to providing analytics for product decisions.

As an example, in this recipe, we'll connect Auth0 with HubSpot, the most popular marketing automation solution for growing businesses. We’ll connect the dots between your users and your brand, and the integrations you use to build those customer relationships. 

The integration between Auth0 by Okta and HubSpot is driven by Actions, an orchestration platform that gives you the freedom to add custom logic (and integrations) to any Identity process. You can orchestrate all sorts of processes — from syncing subscription statuses with Stripe to adding Identity-proofing to calling your own APIs. 



  • HubSpot Developer Account
  • Auth0 Professional or Enterprise Account
  • Auth0 Actions

Configure HubSpot

Create a test environment in HubSpot

  1. Access your HubSpot admin page as a Developer.
  2. On HubSpot's home page, click “Testing.”
  3. Click “Create app test account.”
App test account


  1. Provide a name for your test environment and click “Submit.” The new environment will be created and displayed under the testing page.
Create app test account


  1. Click the test environment account. You will be redirected to the HubSpot CRM dashboard for your test environment.

Create attributes that will receive Identity data from Okta

Tip: You can create attributes to send any information available from Okta during user login, including the user login frequency, location, device, and social provider, among others. For this example, we will map the login count and city.

  1. From the Hubspot CRM dashboard, click the gear icon on the top menu.   JUFrfaGkXbQT06MLdmItWkiftRAtf4Np2XYB2QIxEXgUCMgnSUZfsNY1wc5bHvpgj HeGE7HOZz3zynVpJOMiAS529uTMdNwqmiRGpRzKaBrl9fiUlKb9Q9fQ3P73zglqNcL y 9Qq2jHDqvRiF2gcA  
  2. On the left bar, expand “Data Management > Objects,” and then click “Contacts.”   GbhWsXX5rEkGaVJK4oGPvJx23BRjxKg0UDzQ3WtM8T1K8YEeCaSG TS3xcUJ8O5SnPQmBRNG4iyU lA8CbClea7e5lhJBnfDy7ldlyco9HYmjDv7GnySlQUVLaj8p4lrxMW3y7XwWyPBpEv5D6daNMk


  3. Click “Manage contact properties.”   FJmyraseVuCf9nUMOpFNVIf2S1cfTVMtS6MLHxtJaoDdRVt0Tlee0t4JWkYucggVTulEHW0FD34qX45mfZJOgRmkZV6FpiWRqmJMwOECf9zKYd64Q4qBQWY MnLRthMce5LSVAx QKz lW60WFz5qoE


  4. Click “Create property.”

    NpvxijWzaE0VZ nM3GfW8zNvaswyFGK9CN8M4v 0AHzMWQU2SalcWOB98Nlt7NCAbUNJ20n9pzfXjCKGQUNfuGiyz6a3wRLMASQGyYKOL3 7sB yCfi GW5 GJJImwkacpfrEdoRoh1C4 3 cffIFaI

  5. Enter the following info and click “Next.”
    1. Object type: Contact
    2. Group: Contact Activity
    3. Label: Login Count
  6. Select “Number” as the field type and click “Next.”
  7. On rules, make sure all options are unchecked and click “Create.”
Create a new property login count


  1. Repeat the previous steps to create the field with the following info:
    1. Object type: Contact
    2. Group: Contact Activity
    3. Label: Login City
    4. Field type: Single-line text
Create a new property

Create a HubSpot API token

  1. On the left bar, expand “Account Setup > Integrations,” and then click “Private Apps.”

    66OoflEsiTBRZpOgd4Xy53bjL9ZZxxGQ2rO3YByagNlsBHBwhCKtUooE8oMZIQduBFLnDU19SjLEwLge Mi z3KCkgeVwARlm7QQd8guNbFgs7lGLfnESVvy8x9ozsTgbvLebr5YQjm 7QD2xftE2LE


  2. Click Create a private app

    P68cdPQEIaPDxdjmGvWr lRm2 avU8pLohkDp UF6kUD3q8zde3z9PYk3k vZcH0K5jqAlYulM4fuzMhOrpymqt5zG4lfJSIw3YS6wirU vKBciJAxCEy54AsRjPz KwcIqnekSm5JCOLu1oSIq9Ouo


  3. Add the following attributes:
    • Name: Auth0
    • Scopes:
      • crm.schemas.contacts.write

7FqRBoBjn3ETRCYhJTekTEoXIp Ff LBv4VZOKMeD9qjaHXFHoluuIt0LZcsxmO0mpCpmiUirWRo9nLtTzJfxKNgAu5jQG4fyHulGHkAk6ENjldCeCAEaTrFfChRgnacEJoYY5nn  AdL DUD0OqlfY


  1. After creating the app, record the application API token. Auth0 Actions will use this token to send data to Hubspot.

    KgzYMHUrISiNod boQFoG2oSkhcTkTj5K42C5 aC3v8PqCIkN5RL9ZzDhCcylrkzoS24 xKtK5g9sESY5WyVJpjAj02HIzwHkVP35wb9ymtCn3WSDHCtdHd0e50leofntDF6d2ZioVHr20lRuHdAuC0

Configure Auth0 by Okta Actions

Actions allow you to modify Identity processes — such as registration and login — with your custom logic.

Let’s create a Login Action to send data to HubSpot.

  1. Navigate to “Actions > Library > Build Custom.”

    kuHWGMCxBlCjZ43cQvoboUTfc0eOvqoTJw5JhFMU9l77OTYmXJmaUVcMihB1hxZRrAshE9TNR5cx3GbxNYg3HNRPesT87V8ARwS z jPpSzR9mYJwSjlrz AWptWEwvR89lDSGx0NjrqnQCrUeOwDf8


  2. Here is the logic required for this example. We’ll be using Axios to make an HTTP call to share our user’s first and last name, login frequency, and location based on their email.
Logic part 2
Logic 2


  1. Add Axios as a dependency.


  1. Add your HUBSPOT_SECRET, which is your generated HubSpot API token.


  1. Deploy your Action to save it, then navigate to “Flows > Login,” and add your Custom Action:

    eYu7Rb6VHR2WEV6xnF17HGrHHunyy6r3yBX iCdRZGf3bu8rSC6IEi0HeEzYzauOIVKAGUHdCTshhfRNX4Pfb5mjmjEOanmc3Plpr z Q6nbewQ5RWp gBKIofc5kg974wCxJ8tcmvq50rtQ7BleVBg


  2. Upon successful login or signup (or testing your Action in the sandbox), navigate to HubSpot, and go to “Contacts > Contact” to see the fruits of your Action:

    yNigPwNaA6cmXc4YB7o KR8hCur5TJr3abrJbmq51i0AZJ eAWHhtA9I6kGfDiOohKY7PMrREe20uH6qz7 5TJVYoyJ8xaoNvZLUx UWEajdB0NaLnLQ5EWvwtCpNSjL2MzsisDqqA4RXwDlz73S2bE

Now, HubSpot can use Identity data — login counts, geo, email, name, etc. — in its marketing workflows to customize sales and marketing tactics. For example, send developers SWAG if they signed up with GitHub, log in with high frequency, and their accounts can be associated with a company, with good revenue:


qqUJkvF2nkFBdbi4ZAhY9kUH7LhXPdkQf5duYIKSmD hXCMKyCmKozqUDfWfwt9cadbIeVpvOiRPLziAk IIVhEpRlVbZDZXpcoqEzYIw2mR21Yowcte9FcWf1G94dgP6RSLQPRTpb4KvClLefMIX8s


Phase 3: Ensure your customer contacts are legit

As the influx of fraudulent activity on the web has no end in sight (for now), fake accounts can often derail business operations and skew reporting that contributes to vital assessments for growth.

To ensure your customer contacts are who they say they are, Auth0 by Okta has a number of tools to stop illegitimate traffic at the front door of your applications. Our prevent fraudulent activities recipe shows how to maintain UX for your legitimate customers while keeping bad actors — and bots — out. And if you want to see all recipes in a comprehensive guide, download our cookbook.