Git Product home page Git Product logo

slacker's Introduction

slacker

Erlang Slack REST API wrapper.

To use slacker, you need a bearer token; see the Slack documentation for details.

Warning: a token is equivalent to a username (for a given team) plus a password. Manage and store it securely.

Installation

Slacker is built with rebar3. We provide a make wrapper for convenience.

To build the application simply run make all. This will build the .beam, .app files and the documentation.

To generate the documentation, run make doc.

Or add it to your rebar.config

{deps, [
    ....
    {slacker, {git, "git://github.com/julienXX/slacker.git", {branch, "master"}}}
]}.

Note that the way dependencies are handled has changed from rebar2 to rebar3. Read rebar3 Upgrading dependencies for details.

Testing

The tests need connectivity to slack.com and the majority of them also need a bearer token.

Get a token following the instructions at the beginning of this document, then create file priv/token.txt containing your token. Use priv/token.txt.example as a template.

To run the tests use make test.

Quick start

λ rebar shell
Eshell V8.2  (abort with ^G)
1> application:ensure_all_started(slacker).
2> Token = "your team token".
2> Options = [].
4> {ok, Status, Headers, Body} = slacker_user:list(Token, Options).

Message formatting

Slack messages are JSON structures that follow a specific formatting. After creating a message you pass it to slacker_chat:post_message/4 as an attachment parameter.

Simple plain text message:

slacker_chat:post_message(<<"Token">>, <<"#channel">>, <<"Hello World!">>, []).

Simple message with a bot icon and a colored left border:

Msg = slacker_rich_messages:format(<<"Hello">>, <<"Hello World!">>, <<"#df4f18">>).
slacker_chat:post_message(<<"Token">>, <<"#channel">>, <<"Hello World!">>, [{attachments, Msg}]).

Simple message with a table, a bot icon and a colored left border:

Fields = [[{title, "Col"}, {value, 1}]].
Msg = slacker_rich_messages:format_table(<<"Hello">>, <<"Hello World!">>, Fields, <<"#df4f18">>).
slacker_chat:post_message(<<"Token">>, <<"#channel">>, <<"Hello World!">>, [{attachments, Msg}]).

TODO

  • files.upload API endpoint is not implemented

Contribute

  • Fork slacker
  • Write some new features or fix bug
  • Test it
  • Pull request

LICENSE

License in LICENSE file

More info

More info at [email protected]

slacker's People

Contributors

bitdeli-chef avatar ipinak avatar julienxx avatar kyle-neal avatar leonardb avatar philipcristiano avatar tgrk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

slacker's Issues

The README.md examples needs some commas

The examples in the README.md has a couple of typos and missing commas. You can easily figure out what to do by reading source code, but better fix this at some point.

Des extensions Erlang pour php?

Bonjour!
Serait-il possible d'utiliser les lybrairies et api d'Erlang pour améliorer la performance et faire une économie sur les cpu?
Ou dois-je plustot me tourner ver c/c++ ????

Merci.

slacker.app.src - include restc

If restc is a needed dependency, it has to be included in slacker.app.src which means release managers are able to pick up the dependency when they pack slacker with a release. This avoids one having to specify it explicitly.

Move to rebar3 ?

Salut Julien,

I have many improvements to the tests, because I wanted to add rtm.start. Since I am using rebar3, some changes I made broke running rebar2 eunit. Since rebar2 is deprecated, I think this is not a big deal. I can even update the rebar.config file to use only rebar3 syntax.

On the other hand, I don't have time to also keep backward compatibility with rebar2. I wanted to know, with the goal of contributing my changes, if you are OK with the idea of abandoning support for rebar2.

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.