Show examples in:
Create build trigger

Body Parameters

name  Required  string  Example: "Custom build trigger"

Name of the build trigger

adapter  Required  enum  Example: "custom"

The type of build trigger

indexing_enabled  Required  boolean  Example: true

Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content

frontend_url  Required  string, null  Example: ""

The public URL of the frontend. If Site Search is enabled (indicated by indexing_enabled), this is the starting point from which the website's spidering will start

adapter_settings  Required  object  Example: {"trigger_url":"","headers":{"Authorization":"Bearer abc123"},"payload":{"type":"build_request"}}

Additional settings for the build trigger. The value depends on the adapter.

autotrigger_on_scheduled_publications  Required  boolean  Example: true

Wheter an automatic build request to webhook_url should be made on scheduled publications/unpublishings

webhook_token  Optional  string  Example: "xA1239ajsk123"

Unique token for the webhook (it's the same token present in webhook_url)


Returns a build_trigger resource object.


Example Basic example
import { buildClient } from '@datocms/cma-client-node';
async function run() {
const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
const buildTrigger = await client.buildTriggers.create({
name: 'Custom build trigger',
adapter: 'custom',
indexing_enabled: true,
frontend_url: '',
adapter_settings: {
trigger_url: '',
headers: {
Authorization: 'Bearer abc123'
payload: {
type: 'build_request'
autotrigger_on_scheduled_publications: true