Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

665 B
Raw Blame
import { getServerFeatureFlagsStateFromRuntimeConfig } from '@/server/featureFlags';

/**
 * Whether inbound webhooks wake this user's Agents (runtime flag `webhook`, off by default).
 * Off: deliveries are still verified, recorded and acknowledged, but run nothing.
 *
 * An unreadable flag counts as off.
 */
export const isWebhookEnabled = async (userId?: string | null): Promise<boolean> => {
  try {
    return (
      (await getServerFeatureFlagsStateFromRuntimeConfig(userId ?? undefined)).enableWebhook ===
      true
    );
  } catch (error) {
    console.error('[inboundWebhook] Failed to read the webhook feature flag:', error);
    return false;
  }
};