Skip to main content
Preview
Preview Feature — This feature is currently in preview and under active development. APIs and functionality may change. We recommend testing thoroughly before using in production.

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.

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({
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({
access_tag: "admin",
webhook_tag: "order_created",
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.