Skip to main content

Managing App Webhooks

Ductape enables product teams to manage webhook integrations across environments using the ductape.products.webhooks interface. Webhooks are essential for allowing third-party apps to notify your product of events in real time. Ductape acts as a middleware—offering visibility, control, and flexibility in how webhooks are registered and used.

There are two ways to set up webhook registrations in Ductape:

  1. Full Registration – Configure webhooks across all required environments by supplying the necessary configuration up front.
  2. Generate Registration Link – Create a Ductape-wrapped URL for a single environment and paste it into a provider dashboard.

Full Registration

Use the enable method to register a webhook for multiple environments at once. This is ideal when your provider allows API-based registration or if you want to fully manage all environments centrally.

Required Fields

NameTypeDescription
productstringProduct slug
access_tagstringUnique access tag for the app
webhook_tagstringIdentifier for the webhook
envsIProductBuilderRegisterWebhookEnvs[]List of environment-specific configurations

IProductBuilderRegisterWebhookEnvs

FieldTypeDescription
slugstringEnvironment slug (prd, stg, etc.)
urlstringReceiver webhook endpoint
methodHttpMethodsHTTP method used (POST, GET)
authIActionRequestRequest authentication and structure

Example

await ductape.products.webhooks.enable({
product: "my-product",
access_tag: "admin",
webhook_tag: "order_created",
envs: [
{
slug: "prd",
url: "https://api.example.com/webhooks/orders",
method: HttpMethods.POST,
auth: {
headers: {
Authorization: "Bearer <<token>>"
},
query: {},
body: {},
params: {}
}
},
{
slug: "stg",
url: "https://staging.example.com/webhooks/orders",
method: HttpMethods.POST,
auth: {
headers: {
Authorization: "Bearer <<token>>"
},
query: {},
body: {},
params: {}
}
}
]
});

Use the generateLink method when your provider requires you to manually input the webhook URL in their dashboard. Ductape will generate a wrapped tracking link that routes through its middleware.

Required Fields

NameTypeDescription
productstringProduct slug
access_tagstringApp's access tag
webhook_tagstringIdentifier for the webhook
envstringEnvironment slug
urlstringOriginal webhook endpoint
methodHttpMethodsHTTP method (POST, GET, etc.)

Example

const link = await ductape.products.webhooks.generateLink({
product: "my-product",
access_tag: "admin",
webhook_tag: "order_created",
env: "prd",
url: "https://api.example.com/webhooks/orders",
method: HttpMethods.POST
});

console.log("Register this link in your provider dashboard:", link);

Fetching Registered Webhooks

To see which webhooks are currently registered for an app, use the fetchAll method.

Example

const webhooks = await ductape.products.webhooks.fetchAll("admin");

Parameters

NameTypeDescription
accessTagstringThe access tag for the target app

Returns

An array of webhook configurations associated with the given access tag.

Choosing the Right Method

MethodBest Use Case
Full RegistrationYou can register webhooks programmatically across all environments at once.
Generate Registration LinkYou need a single environment-specific link to paste into a provider UI.