For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save Schema Trigger

Create or update a schema (database) trigger.

A schema trigger runs an action automatically when records change in a collection — for example emailing the team when a record is inserted, or calling a webhook when one is deleted. It watches one schema (set schemaId) and fires on OnInserted, OnUpdated, or OnDeleted. This method creates the trigger (or updates it when you pass an existing triggerId); the response returns its id.

This method is on the Hub surface (norbix.hub.database) — call it from admin tooling or IaC.

These examples assume the SDK is installed and your credentials are set as environment variables — each client reads them automatically, so the constructors below take no arguments. See Install a Norbix SDK.

import { Norbix } from '@norbix.ai/ts';
const norbix = new Norbix();

const result = await norbix.hub.database.saveSchemaTrigger({
  trigger: {
    type: 'Schema',
    when: 'OnInserted',
    name: 'notify-on-insert',
    isEnabled: true,
    schemaId: 'sch_6q37t61LzEQQBWDaRfJ8JS',
    action: {
      type: 'email',
      templateId: 'tmpl_5XqvoF4k6I2GfarDBg3zqq',
      deliverySettings: { recipientsSourceType: 'AllUsers' },
    },
  },
});
using Norbix.Sdk;
using Norbix.Sdk.Types.Hub;

using var client = new NorbixClient();

var result = await client.Database.SaveSchemaTriggerAsync(new SaveSchemaTrigger
{
    Trigger = new SchemaTriggerRequest
    {
        Type = TriggerType.Schema,
        When = SchemaTriggerType.OnInserted,
        Name = "notify-on-insert",
        IsEnabled = true,
        SchemaId = "sch_6q37t61LzEQQBWDaRfJ8JS",
        Action = new TriggerActionEmailDto
        {
            Type = TriggerActionType.Email,
            TemplateId = "tmpl_5XqvoF4k6I2GfarDBg3zqq",
            DeliverySettings = new EmailToAllUsersDeliverySettingsDto
            {
                RecipientsSourceType = EmailCampaignRecipientsSourceTypes.AllUsers,
            },
        },
    },
});

Scenarios

The examples above send an email to all users. The action object is where the behaviour lives — here is one working example for every action type (JavaScript; the structure is identical in the other SDKs, only syntax changes as in the tabs above).

Email specific users

Send a templated email to chosen project users when a record is inserted.

Email raw addresses

Send the email to fixed addresses (an ops inbox, an external partner) instead of project users.

Push notification to all users

Send a mobile push from a push template to every user when a record is inserted.

SMS to phone numbers

Send a text message to fixed phone numbers.

Call a webhook

Publish the event to your configured webhook destinations. Destinations (URLs, secrets) are managed in the Webhooks module; here you only pick which ones receive it.

Run a function

Execute one of your functions from the Code module with the event as input.

Send a realtime (SSE) event

Push a server-sent event to connected clients — for live UI updates.

Run a marketplace function

Fire an installed marketplace function; payload passes extra static values.

For every field of every shape (CC/BCC, campaign timing, timezone settings, token mappings, collection-based audiences), see the API reference. More runnable examples live in the SDK repos on GitHub.

In the dashboard

Manage this visually in Norbix Cloud — see Database → Collections → Triggers.

API reference

Full request and response for this endpoint: Save Schema Trigger.

Last updated