Coder Social home page Coder Social logo

slack-java-webhook's Introduction

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

slack-java-webhook's People

Contributors

ashwanthkumar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.