Skip to content

Flows
Pro

Flows are a more advanced form of event tracking that allow you to see how a user's threat signals change within a larger process.

For example, a loan application may have 4 steps:

  1. Provide Details
  2. Request Amount
  3. Review Offer
  4. Accept Offer

You could track each step as an individual event using honeypot.track, but the flows feature allows us to add even more context around the event to improve visibility further.

Creating flows

Flows are created using the honeypot.flow method. The code snippet demonstrates the process.

js
// Optionally identify the user *before* you create the flow
honeypot.identify('user-1234', {'foo': 'bar'}, 'account')

// You can optionally link other identities, too
// (email, merchant_id, partner_id, web3_wallet, etc)
honeypot.identify('merchant-1234', {'foo': 'bar'}, 'merchant_id')

// Create the flow
const flow = await honeypot.flow(
  'Loan application',
  'APP-ID-123'
)

Adding steps to a flow

Next, you need to add steps to the flow.

You can add any number of steps to a flow, and start/complete each step independently.

js
// You can start and complete the steps independently, which allows us
// to capture detailed timing info
const step = flow.step('Request Amount')
step.start()
step.complete()

You can also start and complete a step immediately.

js
// Or, you could start and complete immediately
flow.step('Request Amount').complete()

Whenever you complete a step, you can add additional metadata. For example:

js
flow.step('Request Amount').complete(
    {'amount': 100}
)

Under the hood, we store flow events alongside regular events. However, we are able to use the additional flow context to surface even more insights.

Once you've added your flow steps, you can gather the honey.