Skip to main content

Quick Start

Install the plugin:
pnpm install @corsair-dev/typeform
Add the Typeform plugin to your Corsair instance:
corsair.ts
import { createCorsair } from "corsair";
import { typeform } from "@corsair-dev/typeform";

export const corsair = createCorsair({
    plugins: [typeform()],
    database: db,
    kek: process.env.CORSAIR_KEK!,
});

Authentication

Supported Auth Types

  • oauth_2 (default) - OAuth 2.0 user authentication

OAuth 2.0 Setup

pnpm corsair setup --typeform client_id=your-client-id client_secret=your-client-secret
pnpm corsair auth --plugin=typeform
See Get Credentials for step-by-step instructions.

Options

OptionTypeDescription
authType'oauth_2'Authentication method
webhookSecretstringWebhook signing secret (optional)
hooksobjectEndpoint hooks for custom logic
webhookHooksobjectWebhook hooks for event handling
errorHandlersobjectCustom error handlers

Usage

// List all forms
const forms = await corsair.typeform.api.forms.list({});

// Get form responses
const responses = await corsair.typeform.api.responses.list({
    formId: "form-id",
});

// Create a form
await corsair.typeform.api.forms.create({
    title: "Customer Feedback",
    fields: [
        { type: "short_text", title: "What did you think?" },
    ],
});

// Get current user
const me = await corsair.typeform.api.me.get({});

Query cached data

const forms = await corsair.typeform.db.forms.search({ data: {} });

const responses = await corsair.typeform.db.responses.search({
    data: { formId: "form-id" },
});

Multi-Tenancy

const tenant = corsair.withTenant("user-123");

const forms = await tenant.typeform.api.forms.list({});