Skip to content

NetlifyIntegration

The NetlifyIntegration provides different methods to help create your integration.

Usage example

// src/index.ts
import { NetlifyIntegration } from "@netlify/sdk";

const integration = new NetlifyIntegration();

// Adding a build event handler
integration.addBuildEventHandler("onPreBuild", () => {
  console.log("This is my first build event handler!");
});

Type parameters

NameType
SiteConfigSchemaZodSchema, undefined
TeamConfigSchemaZodSchema, undefined
BuildContextZodSchema, undefined
BuildConfigSchemaZodSchema, undefined

Methods

addBuildEventContext

addBuildEventContext(func)

Used to add a build context to the integration that can be used in a build event handler.

Parameters

NameType
handlerfunc

Returns

Returns a promise with an object.


addBuildEventHandler

addBuildEventHandler(type, func)

Used to add a build event handler to the integration.

Parameters

NameType
typeBuildHookType, one of the build events
funcfunc

Returns

void


addConnector

addConnector(config)

Used to create a connector for the integration.

Parameters

NameType
configConnectorConfig

Returns

A NetlifyConnector.


addApiHandler

addApiHandler(name, func)

Used to add an API handler to the integration.

Parameters

NameType
namestring
funcfunc

Returns

void


onDisable

onDisable(func)

Used to customize the disable flow.

Parameters

NameType
funcfunc

Returns

void


onEnable

onEnable(func)

Used to customize the enable flow.

Parameters

NameType
funcfunc

Returns

void