Giter Site home page Giter Site logo

julialangslack / slack.jl Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 7.0 282 KB

A (UNOFFICIAL) wrapper of the SlackAPI in Julia

Home Page: https://julialangslack.github.io/Slack.jl/

License: MIT License

Julia 100.00%
slack slack-api julia julia-language

slack.jl's Introduction

Slack

Check out the Docs

Current State

The only feature that still needs to be actively developed for the single production project utalizing this code is the addition of some functions for threaded messages. Once this is done, unless there is a community requested addition, this code will remain pretty much static.

Feel free to open an issue or Pull Request with additions or feature requests/bugs.

Setup

The first thing you will need to use this package is a Slack Workspace to install a Slack app into.

After that, you will need to add a webhook to your app such that you can send and retrieve data from the Slack Workspace.

Install

julia> ]
(v1.3) pkg> add Slack

Usage

Here is a simple example:

Note that the endpoint in the example and tests was deprecated automatically by Slack's API Security Crawler.

julia> using Slack

julia> endpoint = "/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"
"/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"

julia> data = "Hello World"
"Hello World"

julia> response = sendtoslack(data, endpoint)
"ok"

The result of running this code produces the following in the test Slack Workspace:

logo

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.

You can also check your messages format using Slacks Message Formatting Tool.

And here is a more complicated example using attachments:

julia> using Slack

julia> endpoint = "/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"
"/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE"

julia> attachment = Dict("attachments" => [Dict("fallback" => "Required plain-text summary of the attachment",
                                               "color" => "#36a64f",
                                               "pretext" => "Optional text that appears above the attachment block",
                                               "author_name" => "Bobby Tables",
                                               "author_link" => "http://flickr.com/bobby/",
                                               "author_icon" => "http://flickr.com/icons/bobby.jpg",
                                               "title" => "Slack API Documentation",
                                               "title_link" => "https://api.slack.com/",
                                               "text" => "Optional text that appears within the attachment",
                                               "fields" => [Dict("title" => "Priority",
                                                   "value" => "High",
                                                   "short" => false
                                                   )]
                                           )])
Dict{String,Array{Dict{String,Any},1}} with 1 entry:
  "attachments" => Dict{String,Any}[Dict("author_link"=>"http://flickr.com/bob"


julia> response = sendattachmenttoslack(attachment, endpoint)
"ok"

The result of running this code produces the following in the test Slack Workspace:

logo

slack.jl's People

Contributors

hyrodium avatar imgbotapp avatar logankilpatrick avatar patriciasparreo avatar racinmat avatar soumitradev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

slack.jl's Issues

Add tagbot

It would be helpful if there would be tagged releases. Should I make PR for it?

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

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.