Logo

Documentation

Programmatic Flow

How to create and use Programmatic Flows

Prerequisites

Before you begin, ensure you have:

  • A Quotient account with an API key with flow:trigger or all scope
  • A React/Next.js project set up
  • Installed the Quotient SDK

Creating a Programmatic Flow

Within Quotient, you can set the Trigger type of a flow to PROGRAMMATIC. Additionally, you can restrict this trigger to apply to a specific segment as you can with other triggers.

Programmatic Flow

Triggering a Programmatic Flow

From within your app, you can add the following snippet to trigger a flow:

Server Side

import { QuotientServer } from "@quotientjs/server";
 
const client = new QuotientServer({...});
 
const data = await client.flow.trigger({
  flowId: `YOUR-FLOW-ID`,
  personId: `PERSON-FOR-FLOW`
});

Client Side

import { QuotientClient } from '@quotientjs/client';
 
const client = new QuotientServer({...});
 
const data = await client.flow.trigger({
  flowId: `YOUR-FLOW-ID`,
  personId: `PERSON-FOR-FLOW`
});

That's it!