function getWebhookUrls()

in packages/webhook-triggers-app/src/workflows/workflow-http.js [33:61]


function getWebhookUrls(ctx, settingsKey) {
  // Parse event-specific webhooks
  const webhooksStr = ctx.settings[settingsKey] || '';
  const eventUrls = parseWebhookUrls(webhooksStr);

  // Parse "All Events" webhooks
  const allEventsWebhooksStr = ctx.settings.webhooksOnAllEvents || '';
  const allEventsUrls = parseWebhookUrls(allEventsWebhooksStr);

  // Combine and deduplicate
  const urlSet = {};
  const allUrls = [];

  eventUrls.forEach(function (url) {
    if (url && !urlSet[url]) {
      allUrls.push(url);
      urlSet[url] = true;
    }
  });

  allEventsUrls.forEach(function (url) {
    if (url && !urlSet[url]) {
      allUrls.push(url);
      urlSet[url] = true;
    }
  });

  return allUrls;
}