Choose your language:
    Create build trigger
    Parameters
    name  string  Optional

    Name of the environment

    adapter  string  Optional

    The deploy adapter

    indexingEnabled  boolean  Optional

    Enable scraper on the site

    frontendUrl  string, null  Optional

    Public url of the site

    adapterSettings  object  Optional

    Additional configuration for deploy

    autotriggerOnScheduledPublications  boolean  Optional

    Deploy on scheduled publication

    webhookToken  string  Optional

    Unique token of the webhook

    Returns
    Returns a build_trigger object.

    Examples

    Example code:
    const SiteClient = require('datocms-client').SiteClient;
    const client = new SiteClient('YOUR-API-TOKEN');
    client.buildTrigger.create({
    name: 'Production',
    webhookToken: 'xA1239ajsk123',
    adapter: 'netlify',
    indexingEnabled: true,
    frontendUrl: 'https://www.mywebsite.com/',
    autotriggerOnScheduledPublications: true,
    adapterSettings: {
    triggerUrl: 'https://api.netlify.com/build_hooks/XXX',
    siteId: 'XXX',
    branch: 'master'
    }
    })
    .then((buildTrigger) => {
    console.log(buildTrigger);
    })
    .catch((error) => {
    console.error(error);
    });
    Returned output:
    > node example.js
    {
    "id": "1822",
    "name": "Production",
    "adapter": "netlify",
    "adapterSettings": {
    "triggerUrl": "https://api.netlify.com/build_hooks/XXX",
    "siteId": "XXX",
    "branch": "master"
    },
    "lastBuildCompletedAt": "2017-03-30T09:29:14.872Z",
    "buildStatus": "success",
    "webhookToken": "xA1239ajsk123",
    "webhookUrl": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results",
    "indexingStatus": "success",
    "frontendUrl": "https://www.mywebsite.com/",
    "autotriggerOnScheduledPublications": true,
    "indexingEnabled": true
    }