import t from"@contractspec/lib.ui-link";import{ChevronRight as o}from"lucide-react";import{jsx as e,jsxs as a}from"react/jsx-runtime";function d(){return a("div",{className:"space-y-8",children:[a("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Slack Messaging"}),e("p",{className:"text-muted-foreground",children:"ContractSpec supports signed Slack event ingestion and outbox-backed outbound replies through the channel runtime."})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),e("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:e("pre",{children:`// secret payload
{
  "botToken": "xoxb-...",
  "signingSecret": "..."
}

// optional connection config
{
  "defaultChannelId": "C0123456789",
  "apiBaseUrl": "https://slack.com/api"
}`})})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Webhook ingress"}),a("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[a("li",{children:["Inbound events are accepted on"," ",e("code",{className:"rounded bg-background/50 px-2 py-1",children:"/webhooks/slack/events"}),"."]}),a("li",{children:["Requests are validated with Slack signatures (",e("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-slack-signature"})," ","+ timestamp tolerance)."]}),e("li",{children:"Normalized events are deduplicated and persisted before any outbound side effects."})]})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Workspace routing and dispatch"}),e("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:e("pre",{children:`# Workspace mapping (recommended)
CHANNEL_WORKSPACE_MAP_SLACK={"T123":"workspace-acme"}

# Dispatch protection
CHANNEL_DISPATCH_TOKEN=...

# Optional scheduler
CHANNEL_DISPATCH_INTERVAL_MS=120000
CHANNEL_DISPATCH_RUN_ON_START=1`})})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Best practices"}),a("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[e("li",{children:"Keep bot tokens and signing secrets in a managed secret provider."}),e("li",{children:"Use workspace mapping to prevent cross-tenant event leakage."}),e("li",{children:"Keep dispatch asynchronous so webhook handlers stay fast and reliable."}),e("li",{children:"Monitor telemetry for ingest, decision, outbox, and dispatch stages."})]})]}),a("div",{className:"flex items-center gap-4 pt-4",children:[e(t,{href:"/docs/integrations/twilio",className:"btn-ghost",children:"Previous: Twilio SMS"}),a(t,{href:"/docs/integrations/github",className:"btn-primary",children:["Next: GitHub Messaging ",e(o,{size:16})]})]})]})}export{d as IntegrationsSlackPage};
