Skip to content

Commit 53e7096

Browse files
committed
Updating README with SlackAttachment notes
1 parent 2fa9842 commit 53e7096

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,33 @@ libraryDependencies += "in.ashwanthkumar" % "slack-java-webhook" % "0.0.2"
2121

2222
## Usage
2323
```java
24-
Slack slack = new Slack("https://hooks.slack.com/services/...");
25-
slack.icon(":smiling_imp:") // Anything from http://www.emoji-cheat-sheet.com/ should work here
24+
// Using SlackMessage
25+
new Slack().icon(":smiling_imp:") // Anything from http://www.emoji-cheat-sheet.com/ should work here
2626
.sendToUser("slackbot")
2727
.displayName("slack-java-client")
2828
.push(new SlackMessage("Text from my Slack-Java-Client"));
29+
30+
// Using SlackAttachment
31+
new Slack()
32+
.sendToUser("slackbot")
33+
.displayName("slack-java-client")
34+
.push(new SlackAttachment("Text from my Slack-Java-Client").author("ashwanthkumar", "https://avatars0.githubusercontent.com/u/600279?v=3&s=40"));
35+
2936
```
3037

3138
## Notes
32-
With `SlackMessage` you can create rich text like
39+
With `SlackMessage` you can create rich text as specified in https://api.slack.com/docs/formatting. Example usage
3340
```java
34-
new SlackMessage()
35-
.text("Some text can be ")
41+
new SlackMessage("Some text can be")
3642
.italic("Italic")
3743
.text(". :)")
3844
```
45+
With `SlackAttachment` you can create much more sophisticated rich text as specified in https://api.slack.com/docs/attachments. Example usage
46+
```java
47+
new SlackAttachment()
48+
.author("ashwanthkumar")
49+
.author("ashwanthkumar", "https://avatars0.githubusercontent.com/u/600279?v=3&s=40")
50+
```
3951

4052
Available methods
4153
- `text`

0 commit comments

Comments
 (0)