# Slack Slash Command

> Slack slash command payload with user, channel, command text, and response URL.

- Name: `slack-slash-command`
- Categories: slack
- Depends on: `@open-types/slack-shared`
- Detail page: https://open-types.dev/types/slack-slash-command

## Install

```bash
# Types only
npx shadcn add @open-types/slack-slash-command

# Types + Zod v4 validators
npx shadcn add @open-types/slack-slash-command-zod

# Types + real-world examples
npx shadcn add @open-types/slack-slash-command-examples
```

## Types

```typescript
import type { SlackUser, SlackChannel } from "./slack-shared";

export interface SlackSlashCommand {
  token: string;
  team_id: SlackUser["team_id"];
  team_domain: string;
  channel_id: SlackChannel["id"];
  channel_name: SlackChannel["name"];
  user_id: SlackUser["id"];
  user_name: SlackUser["name"];
  command: string;
  text: string;
  trigger_id: string;
  response_url: string;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { SlackSlashCommand } from "../types/slack-slash-command";

export const slackSlashCommandSchema = z.object({
  token: z.string(),
  team_id: z.string(),
  team_domain: z.string(),
  channel_id: z.string(),
  channel_name: z.string(),
  user_id: z.string(),
  user_name: z.string(),
  command: z.string(),
  text: z.string(),
  trigger_id: z.string(),
  response_url: z.string(),
}) satisfies z.ZodType<SlackSlashCommand>;

export type { SlackSlashCommand } from "../types/slack-slash-command";
```

## Examples

```typescript
// Source: https://api.slack.com/interactivity/slash-commands#app_command_handling
// Captured: 2026-05
import type { SlackSlashCommand } from "../types/slack-slash-command";
import { slackIds } from "./shared/slack.examples";

const deploy = {
  token: "legacy-verification-token",
  team_id: slackIds.team,
  team_domain: "opentypes",
  channel_id: slackIds.channel,
  channel_name: "deployments",
  user_id: slackIds.user,
  user_name: "marco",
  command: "/deploy",
  text: "production api",
  trigger_id: "13345224609.738474920.8088930838d88f008e0",
  response_url: "https://hooks.slack.com/commands/T12345678/1234/abcdef",
} as const satisfies SlackSlashCommand;

export const slackSlashCommandExamples = {
  deploy,
  emptyText: { ...deploy, text: "" } satisfies SlackSlashCommand,
  help: { ...deploy, command: "/help", text: "" } satisfies SlackSlashCommand,
  remind: {
    ...deploy,
    command: "/remind",
    text: 'me to deploy in 1 hour',
  } satisfies SlackSlashCommand,
} as const;
```
