Slack Webhook (Java)

Slack Webhook API in Java

License

License

Categories

Categories

Java Languages Ant Build Tools
GroupId

GroupId

in.ashwanthkumar
ArtifactId

ArtifactId

slack-java-webhook
Last Version

Last Version

0.0.10
Release Date

Release Date

Type

Type

jar
Description

Description

Slack Webhook (Java)
Slack Webhook API in Java
Project URL

Project URL

https://github.com/ashwanthkumar/slack-java-webhook
Source Code Management

Source Code Management

https://github.com/ashwanthkumar/slack-java-webhook

Download slack-java-webhook

How to add to project

<!-- https://jarcasting.com/artifacts/in.ashwanthkumar/slack-java-webhook/ -->
<dependency>
    <groupId>in.ashwanthkumar</groupId>
    <artifactId>slack-java-webhook</artifactId>
    <version>0.0.10</version>
</dependency>
// https://jarcasting.com/artifacts/in.ashwanthkumar/slack-java-webhook/
implementation 'in.ashwanthkumar:slack-java-webhook:0.0.10'
// https://jarcasting.com/artifacts/in.ashwanthkumar/slack-java-webhook/
implementation ("in.ashwanthkumar:slack-java-webhook:0.0.10")
'in.ashwanthkumar:slack-java-webhook:jar:0.0.10'
<dependency org="in.ashwanthkumar" name="slack-java-webhook" rev="0.0.10">
  <artifact name="slack-java-webhook" type="jar" />
</dependency>
@Grapes(
@Grab(group='in.ashwanthkumar', module='slack-java-webhook', version='0.0.10')
)
libraryDependencies += "in.ashwanthkumar" % "slack-java-webhook" % "0.0.10"
[in.ashwanthkumar/slack-java-webhook "0.0.10"]

Dependencies

compile (3)

Group / Artifact Type Version
in.ashwanthkumar : my-java-utils jar 0.0.7
com.google.code.gson : gson jar 2.3.1
com.google.http-client : google-http-client-gson jar 1.19.0

test (3)

Group / Artifact Type Version
junit : junit jar 4.10
org.hamcrest : hamcrest-all jar 1.1
org.mockito : mockito-all jar 1.10.19

Project Modules

There are no modules declared in this project.

Build Status

slack-java-webhook

Java Client to Slack's Webhook feature.

Dependencies

For Maven,

<dependency>
  <groupId>in.ashwanthkumar</groupId>
  <artifactId>slack-java-webhook</artifactId>
  <version>${slack-java-webhook.version}</version>
</dependency>

For SBT,

libraryDependencies += "in.ashwanthkumar" % "slack-java-webhook" % scalaJavaWebhookVersion

Latest version of slack-java-webhook is scala-java-webhook on Maven Central

Usage

// Using SlackMessage
new Slack(webhookUrl)
    .icon(":smiling_imp:") // Ref - http://www.emoji-cheat-sheet.com/
    .sendToUser("slackbot")
    .displayName("slack-java-client")
    .push(new SlackMessage("Text from my ").bold("Slack-Java-Client"));

// Using SlackAttachment
new Slack(webhookUrl)
    .sendToUser("slackbot")
    .displayName("slack-java-client")
    .push(new SlackAttachment("Text from my Slack-Java-Client").author("ashwanthkumar", "https://avatars0.githubusercontent.com/u/600279?v=3&s=40"));

Notes

With SlackMessage you can create rich text as specified in https://api.slack.com/docs/formatting. Example usage

new SlackMessage("Some text can be")
    .italic("Italic")
    .text(". :)")

Available methods on SlackMessage

  • text
  • link
  • bold
  • italic
  • code
  • preformatted
  • quote

With SlackAttachment you can create much more sophisticated rich text as specified in https://api.slack.com/docs/attachments. Example usage

new SlackAttachment()
    .author("ashwanthkumar")
    .author("ashwanthkumar", "https://avatars0.githubusercontent.com/u/600279?v=3&s=40")

Available methods on SlackAttachment

  • fallback
  • color
  • preText
  • author
  • title
  • text
  • imageUrl
  • addField

License

http://www.apache.org/licenses/LICENSE-2.0

Versions

Version
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1