CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-slack--types

Comprehensive TypeScript type definitions for building Slack applications and integrations with the Node Slack SDK

94

1.11x
Overview
Eval results
Files

dialog.mddocs/

Dialog Interface

⚠️ DEPRECATED: Dialogs are a deprecated surface in Slack. For new development, use Views and Modals instead. This interface is maintained for legacy application support.

Migration Notice

Dialogs have been replaced by Block Kit modals which provide better user experience and more flexibility. See the official migration guide for upgrading to modals.

Capabilities

Dialog Interface

Legacy dialog structure for simple form collection in Slack applications.

/**
 * @deprecated Dialogs are deprecated. Use Block Kit modals instead.
 * @see https://docs.slack.dev/block-kit/upgrading-outmoded-dialogs-to-modals
 */
interface Dialog {
  /** Dialog title displayed to users */
  title: string;
  /** Callback identifier for handling submissions */
  callback_id: string;
  /** Array of form elements */
  elements: DialogElement[];
  /** Custom text for submit button (default: "Submit") */
  submit_label?: string;
  /** Whether to notify when dialog is cancelled */
  notify_on_cancel?: boolean;
  /** Optional state data to include with submissions */
  state?: string;
}

interface DialogElement {
  /** Element type */
  type: 'text' | 'textarea' | 'select';
  /** Element identifier */
  name: string;
  /** Label shown to user */
  label: string;
  /** Whether element is optional */
  optional?: boolean;
  /** Placeholder text */
  placeholder?: string;
  /** Default value */
  value?: string;
  
  // Text and textarea specific
  /** Maximum character length */
  max_length?: number;
  /** Minimum character length */
  min_length?: number;
  /** Help text shown below element */
  hint?: string;
  /** Input validation subtype */
  subtype?: 'email' | 'number' | 'tel' | 'url';
  
  // Select specific  
  /** Data source for select options */
  data_source?: 'users' | 'channels' | 'conversations' | 'external';
  /** Pre-selected options */
  selected_options?: SelectOption[];
  /** Static option list */
  options?: SelectOption[];
  /** Grouped options */
  option_groups?: {
    label: string;
    options: SelectOption[];
  }[];
  /** Minimum characters before external search */
  min_query_length?: number;
}

interface SelectOption {
  /** Option text shown to user */
  label: string;
  /** Option value sent to application */
  value: string;
}

Legacy Usage Example:

import { Dialog, SelectOption } from "@slack/types";

// Simple text input dialog (DEPRECATED - use modals instead)
const legacyDialog: Dialog = {
  title: "Task Creation",
  callback_id: "create_task_dialog",
  elements: [
    {
      type: "text",
      name: "task_title",
      label: "Task Title",
      placeholder: "Enter task title",
      max_length: 100
    },
    {
      type: "textarea", 
      name: "task_description",
      label: "Description",
      optional: true,
      placeholder: "Describe the task",
      max_length: 500
    },
    {
      type: "select",
      name: "priority",
      label: "Priority",
      options: [
        { label: "Low", value: "low" },
        { label: "Medium", value: "medium" },
        { label: "High", value: "high" }
      ]
    }
  ],
  submit_label: "Create Task"
};

Migration to Modals

Instead of dialogs, use Block Kit modals:

// Modern approach using ModalView
import { ModalView, PlainTextInput, SectionBlock } from "@slack/types";

const modernModal: ModalView = {
  type: "modal",
  title: {
    type: "plain_text",
    text: "Task Creation"
  },
  blocks: [
    {
      type: "input",
      block_id: "task_title",
      label: {
        type: "plain_text", 
        text: "Task Title"
      },
      element: {
        type: "plain_text_input",
        action_id: "title_input",
        placeholder: {
          type: "plain_text",
          text: "Enter task title"
        },
        max_length: 100
      }
    }
    // Add more input blocks as needed
  ],
  submit: {
    type: "plain_text",
    text: "Create Task"
  }
};

Deprecation Timeline

  • Current Status: Deprecated but still functional
  • Support: Legacy applications continue to work
  • Recommendation: Migrate to Block Kit modals for new features
  • Future: Will be removed in next major version of @slack/types

Install with Tessl CLI

npx tessl i tessl/npm-slack--types

docs

block-kit.md

calls.md

dialog.md

events.md

index.md

interactive-elements.md

message-attachments.md

message-metadata.md

views.md

tile.json