Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

475 B
Raw Blame
import { WebClient } from "@slack/web-api";
import { DubApiError } from "../api/errors";

const SLACK_SUPPORT_TIMEOUT_MS = 10_000;

export const getSlackClient = (): WebClient => {
  const token = process.env.DUB_SLACK_ASSISTANT_BOT_TOKEN;
  if (!token) {
    throw new DubApiError({
      code: "internal_server_error",
      message: "Priority Slack support is not available right now.",
    });
  }
  return new WebClient(token, { timeout: SLACK_SUPPORT_TIMEOUT_MS });
};