Metadata-Version: 2.3
Name: slack-events
Version: 0.1.0
Summary: TypedDicts for every Slack event, with optional pydantic validation, FastAPI dispatch, and ergonomic bot handlers
Requires-Dist: typing-extensions>=4.12
Requires-Dist: slack-sdk[optional]>=3.27 ; extra == 'client'
Requires-Dist: fastapi>=0.110 ; extra == 'fastapi'
Requires-Dist: pydantic>=2.0 ; extra == 'fastapi'
Requires-Dist: pydantic>=2.0 ; extra == 'pydantic'
Requires-Python: >=3.11
Provides-Extra: client
Provides-Extra: fastapi
Provides-Extra: pydantic
Description-Content-Type: text/markdown

# slack-events

Typed Slack events, dispatch, and bot reply helpers.

```sh
pip install slack-events
pip install 'slack-events[fastapi,client]'
```

The Python import is `slack_events`. The base package depends only on `typing-extensions`;
`pydantic`, `fastapi`, and `client` extras enable validation, HTTP routing, and the
Slack SDK client respectively.

## Responding with Block Kit

`Thread.post`, `Message.reply`, `SlashCommand.respond`, `Action.respond`, and
string returns from `SlackBot` command handlers accept **standard Markdown**.
They send a `markdown` block and top-level `text` containing the same content for
notifications and screen readers. Slack performs the Markdown conversion.
`post_stream` uses Slack's native Markdown streaming protocol; its post-and-edit
fallback sends blocks on both the initial post and every update.

```python
await message.reply("## Results\n**Done.** See [the report](https://example.com).")
```

Use explicit `blocks=` for interactive layouts, structured `rich_text`, or legacy
Slack `mrkdwn`. In this case `text` is your accessible fallback and should contain
all necessary information. Explicit blocks are passed through unchanged; `[]`
is an intentional opt-out. Raw dictionary returns and the low-level dispatcher
also remain caller-controlled.

`message_payload(text, blocks=...)` exposes the same policy to response layers
that call Slack directly. Generated Markdown is capped at Slack's cumulative
12,000-character limit, with a visible truncation notice. Applications can use
`truncate_markdown` to reserve room for a link to the full response. Callers
supplying their own blocks are responsible for block limits and content.

Slack's references:

- [Markdown blocks for LLM output](https://docs.slack.dev/reference/block-kit/blocks/markdown-block/)
- [Rich text for structured user-authored content](https://docs.slack.dev/reference/block-kit/blocks/rich-text-block/)
- [Fallback text and accessibility](https://docs.slack.dev/reference/methods/chat.postMessage/)
- [Streaming finalization](https://docs.slack.dev/reference/methods/chat.stopStream/)

In mo, finalized replies replace the complete message with Markdown blocks after
stopping a native stream. Blocks passed to `chat.stopStream` would be appended to
the streamed content, so that method is not used to replace the answer.
