Docs / Builder

Schemas

Service schemas describe the fields, labels, validation rules, and help text for each notification service. Use them to render forms or build configuration UIs without hardcoding service-specific knowledge.

getServiceSchemas()

Returns all service schemas as an array.

typescript
import { getServiceSchemas } from '@ambersecurityinc/notifly/builder';

const schemas = getServiceSchemas();
// → ServiceSchema[]

getServiceSchema(service)

Get the schema for a specific service by its registry key.

typescript
import { getServiceSchema } from '@ambersecurityinc/notifly/builder';

const schema = getServiceSchema('discord');
// → ServiceSchema | undefined

console.log(schema?.label);   // 'Discord'
console.log(schema?.fields);  // [{ key: 'webhook_id', ... }, ...]

searchServices(query)

Case-insensitive fuzzy search across label, description, category, scheme, and service key. Returns all schemas if the query is empty.

typescript
import { searchServices } from '@ambersecurityinc/notifly/builder';

const results = searchServices('slack');
// → [{ service: 'slack', label: 'Slack', ... }]

const chatServices = searchServices('chat');
// → Discord, Slack, Telegram, Teams

getServicesByCategory(category)

Filter schemas by category key.

typescript
import { getServicesByCategory } from '@ambersecurityinc/notifly/builder';
import type { ServiceCategory } from '@ambersecurityinc/notifly/builder';

const chatServices = getServicesByCategory('chat');
// → [Discord, Slack, Telegram, Teams]

const selfHosted = getServicesByCategory('self-hosted');
// → [ntfy, Gotify]

Valid category values:

Key Label Services
chatChat & MessagingDiscord, Slack, Telegram, Teams
pushPush NotificationsPushover, Pushbullet
emailEmailEmail
webhookCustom WebhooksWebhook
self-hostedSelf-Hostedntfy, Gotify

getCategories()

Returns all categories with their display labels and service counts.

typescript
import { getCategories } from '@ambersecurityinc/notifly/builder';

const categories = getCategories();
// → [
//   { key: 'chat', label: 'Chat & Messaging', count: 4 },
//   { key: 'push', label: 'Push Notifications', count: 2 },
//   { key: 'email', label: 'Email', count: 1 },
//   { key: 'webhook', label: 'Custom Webhooks', count: 1 },
//   { key: 'self-hosted', label: 'Self-Hosted', count: 2 },
// ]

ServiceSchema type

types
interface ServiceSchema {
  service: string;         // Registry key, e.g. 'discord'
  label: string;           // Display name, e.g. 'Discord'
  description: string;     // Short description
  schemes: string[];       // URL scheme prefixes, e.g. ['discord']
  category: ServiceCategory;
  iconHint: string;        // Icon identifier hint
  fields: ServiceField[];
}

interface ServiceField {
  key: string;             // Field identifier
  label: string;           // Display label
  type: FieldType;         // 'text' | 'password' | 'select' | 'boolean' | 'number'
  required: boolean;
  sensitive: boolean;      // Should be masked in UI
  placeholder?: string;
  helpText?: string;
  defaultValue?: string | number | boolean;
  options?: FieldOption[];
  validation?: FieldValidation;
}

interface FieldValidation {
  pattern?: string;     // Regex pattern
  minLength?: number;
  maxLength?: number;
  min?: number;
  max?: number;
}
← Previous Builder Overview Next → Validation