Giter Site home page Giter Site logo

bluele / slack Goto Github PK

View Code? Open in Web Editor NEW
186.0 10.0 46.0 41 KB

Golang client for the Slack API. **NOTE: This project is already archived, so we recommend that you use https://github.com/slack-go/slack instead.**

License: MIT License

Go 100.00%

slack's Introduction

Slack GoDoc

Golang client for the Slack API. Include the example code using each slack api.

Currently supports:

Method Description Example
channels.history Fetches history of messages and events from a channel. #link
channels.join Joins a channel, creating it if needed. #link
channels.list Lists all channels in a Slack team. #link
chat.postMessage Sends a message to a channel. #link
files.upload Upload an image/file #link
files.info Retrieves the information about an uploaded file #link
groups.invite Invites a user to a private group. #link
groups.create Creates a private group. #link
groups.list Lists private groups that the calling user has access to. #link
users.info Gets information about a channel. #link
users.list Lists all users in a Slack team. #link

Example

package main

import (
  "github.com/bluele/slack"
)

const (
  token       = "your-api-token"
  channelName = "general"
)

func main() {
  api := slack.New(token)
  err := api.ChatPostMessage(channelName, "Hello, world!", nil)
  if err != nil {
    panic(err)
  }
}

Command line tool

If you are looking for slack commandline utility, vektorlab/slackcat probably suits you.

Author

Jun Kimura

slack's People

Contributors

adammck avatar adyatlov avatar bcicen avatar bluele avatar dewey avatar hkparker avatar jaimelopez avatar kagemiku avatar mdalp avatar pftg avatar themartorana avatar yoppi 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  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  avatar  avatar  avatar  avatar  avatar

slack's Issues

HTTPClient should really have a timeout set. (or should allow one to be passed in)

Hello, thanks for this awesome package. I haven't encountered a real-world problem, but looking at the source I noticed that the HTTPClient is declared without a default timeout and I don't see one being set anywhere.
This problem has been discussed at length on the web over the years.

Please consider either allowing the user of the package to pass in an HTTPClient or set some sensible defaults.

Cheers!

Adding support to link_names for webook

It looks like that https://github.com/bluele/slack/blob/master/webhook.go#L15 doesn't have support for link_names.
Would you accept a PR if I add this functionality?

This is what the post request looks like

curl -X POST --data-urlencode 'payload={ \
    "text": "This is posted to @channel and comes from *monkey-bot*.", \
    "channel": "#foobar", \
    "link_names": 1, \
    "username": "monkey-bot", \
    "icon_emoji": ":monkey_face:" \
}' https://hooks.slack.com/services/FOO/BAR

Lack of licence.

Could You add some licence in sources?
Now these sources can not be easily used.

Link Names for Post Message not working

Tried various combinations, but the user name in text is not getting linked

        var options slack.ChatPostMessageOpt

         options.LinkNames = "true"

        api := slack.New(token)

       err := api.ChatPostMessage(channelName, "<@Rishabh> Hello, world!", &options)
       if err != nil {
         panic(err)
       }

Godocs link

It would be really helpful if you could add a godocs link to this repo ๐Ÿ‘

usergroups.list

(apologies in advanced for the unorthodox message to you, i have never done a pull request before #noob).

i forked bluele/slack some time ago so i could get some backend apps up in google appengine. i added usergroups.go (https://github.com/rickt/slack-appengine/blob/master/usergroups.go) to my own repo that implements the usergroups.list Slack API method.

unfortunately i don't know how to do a pull request for a single file. i don't think a full pull request with all my changes would be appropriate because i had to change slack.go to be "appengine aware" (rickt@f66cbd5) and i don't think it makes sense for that to be in your repo at all.

anyway, i thought you might appreciate the usergroups.go and because im a github noob i had no idea how to get it to you the proper way. hope you don't mind me using an "issue" to send it over to you.

thanks for writing such a great codebase to build on! ๐Ÿ‘ :-D

-RMT

Testing with this library in your code base

The ideal situation would be that an interface exists that your slack client implements, that I can then implement a mock version of. At the moment I've got no way of stubbing out the methods for unit testing.

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.