npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@23blocks/block-forms

v5.0.2

Published

Forms block for 23blocks SDK - dynamic forms, schemas, submissions, and form management

Readme

@23blocks/block-forms

Forms block for the 23blocks SDK - dynamic forms, schemas, submissions, landings, surveys, appointments, subscriptions, referrals, and mail templates.

npm version License: MIT

Installation

npm install @23blocks/block-forms @23blocks/transport-http

Overview

This package provides form building and submission functionality including:

  • Forms - Form definitions and configurations
  • Form Schemas - Field definitions with datasource configuration
  • Form Schema Versions - Published schema versions
  • Form Instances - App form assignments with responses
  • Form Sets - Groups of related form schemas with auto-assignment
  • Landings - Landing page form submissions
  • Surveys - Survey form submissions with magic link support
  • Appointments - Appointment scheduling with location and assignment
  • Subscriptions - Newsletter and subscription management
  • Referrals - Referral tracking with source attribution
  • Mail Templates - Email template configuration
  • Application Forms - Public form submission and draft workflows
  • CRM Sync - Synchronize form data with CRM

Quick Start

import { createHttpTransport } from '@23blocks/transport-http';
import { createFormsBlock } from '@23blocks/block-forms';

const transport = createHttpTransport({
  baseUrl: 'https://api.yourapp.com',
  headers: () => {
    const token = localStorage.getItem('access_token');
    return token ? { Authorization: `Bearer ${token}` } : {};
  },
});

const forms = createFormsBlock(transport, {
  apiKey: 'your-api-key',
});

// List forms
const { data: formList } = await forms.forms.list();

// Create a landing submission
await forms.landings.create({
  firstName: 'John',
  lastName: 'Doe',
  email: '[email protected]',
  phoneNumber: '+1234567890',
  message: 'Hello!',
});

Services

forms - Form Management

// List forms
const { data: formList } = await forms.forms.list({
  perPage: 20,
  status: 'active',
});

// Get form by ID
const form = await forms.forms.get('form-id');

// Create form
const newForm = await forms.forms.create({
  code: 'contact-form',
  name: 'Contact Form',
  description: 'Contact us form',
  formType: 'landing',
  sendConfirmationMail: true,
  requireOtpVerification: false,
});

// Update form
await forms.forms.update('form-id', {
  name: 'Updated Contact Form',
  status: 'inactive',
});

// Delete form
await forms.forms.delete('form-id');

formSchemas - Schema Management

// List schemas
const { data: schemas } = await forms.formSchemas.list({
  formUniqueId: 'form-id',
});

// Create schema
const newSchema = await forms.formSchemas.create({
  formUniqueId: 'form-id',
  name: 'Contact Schema',
  formFields: {
    fields: [
      { name: 'name', type: 'text', required: true },
      { name: 'email', type: 'email', required: true },
    ],
  },
  datasource: {},
});

// Update schema
await forms.formSchemas.update('schema-id', {
  formFields: { /* updated fields */ },
});

formInstances - App Form Instances

// List instances
const { data: instances } = await forms.formInstances.list({
  userUniqueId: 'user-id',
  status: 'active',
});

// Create an instance (assignment)
const instance = await forms.formInstances.create('form-id', {
  assignedToEmail: '[email protected]',
  assignedToName: 'John Doe',
  assignedByName: 'Admin',
  expiresAt: '2025-12-31',
});

// Update instance
await forms.formInstances.update('instance-id', {
  responses: [{ fieldId: 'name', value: 'John Doe' }],
  status: 'completed',
});

formSets - Form Set Management

// List form sets
const { data: sets } = await forms.formSets.list();

// Create form set
const newSet = await forms.formSets.create({
  code: 'onboarding',
  name: 'Onboarding Forms',
  description: 'Forms required for new user onboarding',
  enforceSequential: true,
  expirationDays: 30,
  formSetItemsAttributes: [
    { formSchemaUniqueId: 'schema-1', displayOrder: 1, required: true },
    { formSchemaUniqueId: 'schema-2', displayOrder: 2, required: false },
  ],
});

// Match form set
const match = await forms.formSets.match({
  userUniqueId: 'user-id',
  category: 'onboarding',
});

// Auto-assign form set
await forms.formSets.autoAssign({
  userUniqueId: 'user-id',
  formSetUniqueId: 'set-id',
  assignedByName: 'System',
});

landings - Landing Form Submissions

const landing = await forms.landings.create({
  firstName: 'John',
  lastName: 'Doe',
  email: '[email protected]',
  phoneNumber: '+1234567890',
  message: 'I am interested in your product',
  source: 'website',
});

appointments - Appointment Scheduling

const appointment = await forms.appointments.create({
  firstName: 'John',
  lastName: 'Doe',
  email: '[email protected]',
  phoneNumber: '+1234567890',
  startAt: '2025-06-15T10:00:00Z',
  endAt: '2025-06-15T11:00:00Z',
  locationName: 'Main Office',
  locationAddress: '123 Main St',
  assignedToName: 'Dr. Smith',
});

Types

import type {
  Form,
  FormSchema,
  FormSchemaVersion,
  FormInstance,
  FormSet,
  FormSetItem,
  Landing,
  Survey,
  Appointment,
  Subscription,
  Referral,
  MailTemplate,
  CreateFormRequest,
  CreateFormSchemaRequest,
  CreateFormInstanceRequest,
  CreateFormSetRequest,
} from '@23blocks/block-forms';

Error Handling

import { isBlockErrorException, ErrorCodes } from '@23blocks/contracts';

try {
  await forms.landings.create({
    firstName: 'John',
    email: '[email protected]',
  });
} catch (error) {
  if (isBlockErrorException(error)) {
    switch (error.code) {
      case ErrorCodes.VALIDATION_ERROR:
        console.log('Form validation failed:', error.meta?.errors);
        break;
      case ErrorCodes.NOT_FOUND:
        console.log('Form not found');
        break;
    }
  }
}

Related Packages

License

MIT - Copyright (c) 2024 23blocks