Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashwanthkumar/slack-java-webhook
Java Client to Slack's Webhook feature.
https://github.com/ashwanthkumar/slack-java-webhook
slack slackapi
Last synced: about 2 months ago
JSON representation
Java Client to Slack's Webhook feature.
- Host: GitHub
- URL: https://github.com/ashwanthkumar/slack-java-webhook
- Owner: ashwanthkumar
- Created: 2015-01-23T17:14:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T20:49:35.000Z (over 2 years ago)
- Last Synced: 2024-04-14T09:19:02.457Z (9 months ago)
- Topics: slack, slackapi
- Language: Java
- Size: 41 KB
- Stars: 66
- Watchers: 4
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/ashwanthkumar/slack-java-webhook.svg)](https://travis-ci.org/ashwanthkumar/slack-java-webhook)
# slack-java-webhook
Java Client to Slack's Webhook feature.## Dependencies
For Maven,
```xmlin.ashwanthkumar
slack-java-webhook
${slack-java-webhook.version}```
For SBT,
```
libraryDependencies += "in.ashwanthkumar" % "slack-java-webhook" % scalaJavaWebhookVersion
```Latest version of *slack-java-webhook* is [![scala-java-webhook on Maven Central](https://img.shields.io/maven-central/v/in.ashwanthkumar/slack-java-webhook.svg?label=slack-java-webhook&style=plastic)](https://maven-badges.herokuapp.com/maven-central/in.ashwanthkumar/slack-java-webhook)
## Usage
```java
// 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
```java
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
```java
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