https://github.com/traveltime-dev/scala-slack-client
Minimalistic Slack client for Scala language
https://github.com/traveltime-dev/scala-slack-client
client scala slack
Last synced: 10 months ago
JSON representation
Minimalistic Slack client for Scala language
- Host: GitHub
- URL: https://github.com/traveltime-dev/scala-slack-client
- Owner: traveltime-dev
- License: mit
- Archived: true
- Created: 2017-07-21T18:37:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-22T12:16:51.000Z (about 5 years ago)
- Last Synced: 2025-08-17T00:02:37.261Z (10 months ago)
- Topics: client, scala, slack
- Language: Scala
- Homepage:
- Size: 55.7 KB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/traveltime-dev/scala-slack-client/actions/workflows/publish-artifact.yaml)
[](https://maven-badges.herokuapp.com/maven-central/com.traveltime/scala-slack-client_2.12)
About
--------------------------------------------------
Minimalistic [Slack](https://slack.com/) client.
Send an [Incoming Webhooks](https://api.slack.com/incoming-webhooks) message
--------------------------------------------------
```scala
import scala.concurrent.Future
import com.traveltime.slack.SlackHttpClient
import com.traveltime.slack.HooksSlackClient._
val token: String = "XXX/YYY/ZZZ"
val webHooksMessage = HookMessage(
notifications = Seq(Notify.UserId("W123")),
msg = "message text",
attachments = Seq(Attachment("attachment text", Color.Red))
)
val response: Future[Either[Error, Unit]] = SlackHttpClient.sendMsg(webHooksMessage, token)
import scala.concurrent.Await
import scala.concurrent.duration._
println(Await.result(response, 1.minute))
// Right(())
```
Send an [Interactive Message](https://api.slack.com/interactive-messages)
--------------------------------------------------
```scala
import com.traveltime.slack.dto.InteractiveMessage
import com.traveltime.slack.SlackHttpClient
import com.traveltime.slack.dto.InteractiveMessage.{Channel, Block, Divider}
val authToken: String = "secret-auth-token"
val channel: Channel = Channel("channel-id")
val blocks: Vector[Block] = Vector(Divider, Divider, Divider)
val interactiveMessage = InteractiveMessage(channel, blocks)
val response = SlackHttpClient.sendInteractiveMessage(interactiveMessage, authToken)
import scala.concurrent.Await
import scala.concurrent.duration._
println(Await.result(response, 1.minute))
// Right(())
```
SBT dependency
--------------------------------------------------
Check for the latest version and add to your `build.sbt`:
```
libraryDependencies += "com.traveltime" %% "scala-slack-client" % ""
```