Raw Client
The chatops4s-slack-client module is a standalone, low-level Slack API client that chatops4s-slack builds on. You generally won't need it directly, but it's available if you need access to Slack API types or want to call endpoints that the high-level API doesn't expose.
Design
The client was AI-generated with a focus on:
- Tailored for Scala — uses idiomatic Scala 3 features: opaque types for IDs and tokens,
derives Codecfor JSON, enums for closed sets,Optionfor nullable fields. - Strong type safety — token types (
SlackBotToken,SlackAppToken) validate their format at construction. Entity IDs (ChannelId,UserId,TeamId, etc.) are opaque types that prevent accidental mixing. - Verified against official sources — every model type was cross-referenced against the Slack API docs and the Java Slack SDK. Source models include comment links to their reference documentation and Java SDK counterparts.
Usage
Construct a SlackApi with any sttp Backend and a SlackBotToken, then call methods directly:
val api = new SlackApi[IO](backend, botToken)
// Send a message
api.chat.postMessage(
chat.PostMessageRequest(
channel = "#general",
text = "Hello from the raw client",
),
): Unit
// Add a reaction
api.reactions.add(
reactions.AddRequest(
channel = ChannelId("C1234567890"),
timestamp = Timestamp("1234567890.123456"),
name = "thumbsup",
),
): Unit
// Look up a user
api.users.info(users.InfoRequest(user = UserId("U1234567890"))): Unit
There are four client classes, one per token type:
| Class | Token type | Purpose |
|---|---|---|
SlackApi | SlackBotToken (xoxb-) | Chat, reactions, views, conversations, users |
SlackAppApi | SlackAppToken (xapp-) | Socket Mode connections (apps.connections.open) |
SlackConfigApi | SlackConfigToken (xoxe.xoxp-) | App manifest management |
SlackToolingApi | SlackRefreshToken (xoxe-) | Token rotation (tooling.tokens.rotate) |
The high-level chatops4s-slack module re-exports everything you typically need, so you only need to reach into chatops4s.slack.api for lower-level types.