File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 27
27
Takes in a string of data and the endpoint url and returns the HTTP response.
28
28
The response will be "ok" if the request is sent successfully.
29
29
"""
30
- function sendattachmenttoslack (data:: String , user_endpoint:: String )
30
+ function sendattachmenttoslack (data, user_endpoint:: String )
31
31
HTTP. setuseragent! (" HTTP.jl" )
32
32
33
33
34
- params = Dict ( " attachments " => " $( data) " )
34
+ params = data
35
35
base_url = " https://hooks.slack.com"
36
36
37
37
endpoint = user_endpoint
Original file line number Diff line number Diff line change @@ -3,6 +3,19 @@ using Test
3
3
4
4
endpoint = " /services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"
5
5
data = " Hello World"
6
+ attachment = Dict (" attachments" => [Dict (" fallback" => " Required plain-text summary of the attachment" ,
7
+ " color" => " #36a64f" ,
8
+ " pretext" => " Optional text that appears above the attachment block" ,
9
+ " author_name" => " Bobby Tables" ,
10
+ " author_link" => " http://flickr.com/bobby/" ,
11
+ " author_icon" => " http://flickr.com/icons/bobby.jpg" ,
12
+ " title" => " Slack API Documentation" ,
13
+ " title_link" => " https://api.slack.com/" ,
14
+ " text" => " Optional text that appears within the attachment"
15
+ )])
6
16
7
17
response = sendtoslack (data, endpoint)
8
18
@test response == " ok"
19
+
20
+ response2 = sendattachmenttoslack (attachment, endpoint)
21
+ @test response2 == " ok"
You can’t perform that action at this time.
0 commit comments