Skip to content

Commit 25a24bf

Browse files
Updated readme example
1 parent bbf40f2 commit 25a24bf

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ julia> ]
1515
```
1616
_Note that this will not work till the package is registered._
1717

18-
For the time being do:
18+
For the time being do:
1919
```julia
2020
julia> ]
2121
(v1.3) pkg> add https://github.com/logankilpatrick/Slack.jl.git
@@ -36,12 +36,48 @@ julia> data = "Hello World"
3636
julia> response = sendtoslack(data, endpoint)
3737
"ok"
3838
```
39-
The result of running this code produces the following in the test Slack Workspace:
39+
The result of running this code produces the following in the test Slack Workspace:
4040

4141
![logo](assets/readme.png)
4242

4343
To learn more about how data should be formatted before sending it as a argument to the above code, check out the [Slack API Docs](https://api.slack.com/messaging/composing/formatting).
4444

45+
46+
And here is a more complicated example using attachments:
47+
48+
```julia
49+
julia> using Slack
50+
51+
julia> endpoint = "/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"
52+
"/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"
53+
54+
julia> attachment = Dict("attachments" => [Dict("fallback" => "Required plain-text summary of the attachment",
55+
"color" => "#36a64f",
56+
"pretext" => "Optional text that appears above the attachment block",
57+
"author_name" => "Bobby Tables",
58+
"author_link" => "http://flickr.com/bobby/",
59+
"author_icon" => "http://flickr.com/icons/bobby.jpg",
60+
"title" => "Slack API Documentation",
61+
"title_link" => "https://api.slack.com/",
62+
"text" => "Optional text that appears within the attachment",
63+
"fields" => [Dict("title" => "Priority",
64+
"value" => "High",
65+
"short" => false
66+
)]
67+
)])
68+
Dict{String,Array{Dict{String,Any},1}} with 1 entry:
69+
"attachments" => Dict{String,Any}[Dict("author_link"=>"http://flickr.com/bob"
70+
71+
72+
julia> response = sendattachmenttoslack(attachment, endpoint)
73+
"ok"
74+
75+
```
76+
77+
The result of running this code produces the following in the test Slack Workspace:
78+
79+
![logo](assets/readme2.png)
80+
4581
## Testing
4682
I have gone through the trouble of setting up a Slack Workspace in order to test this package. After this is all stabilized, I will remove the endpoint from the Slack Workspace and deprecate the examples you see throughout this repo.
4783

assets/readme2.png

54.7 KB
Loading

0 commit comments

Comments
 (0)