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

task.mdevals/scenario-10/

Slack Message Builder

Build a utility function that generates properly typed Slack message payloads with prominent section headers.

Requirements

You need to implement a function that creates Slack message payloads containing multiple content sections, each with a bold header to organize the information. The function should accept an array of sections, where each section has a title and content text, and return a properly typed Slack message payload.

The message should:

  • Have a bold, prominent header at the top of each section to visually separate content
  • Display descriptive text below each header
  • Return a properly typed structure that can be sent via the Slack Web API

Implementation

@generates

API

export interface ContentSection {
  title: string;
  content: string;
}

export function buildSectionedMessage(sections: ContentSection[]): MessagePayload;

interface MessagePayload {
  blocks: unknown[];
}

Test Cases

  • Given a single section with title "Status Update" and content "All systems operational", returns a message payload with appropriate header and text blocks @test
  • Given two sections with titles "Q1 Results" and "Q2 Goals", returns a message payload with two sets of header and text blocks in order @test
  • Given an empty sections array, returns a message payload with an empty blocks array @test

Dependencies { .dependencies }

@slack/types { .dependency }

Provides TypeScript type definitions for Slack Block Kit messages and components.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-slack--types

tile.json