{"id":24883242,"url":"https://github.com/ajm188/slack","last_synced_at":"2025-06-17T06:35:11.837Z","repository":{"id":57551705,"uuid":"50693719","full_name":"ajm188/slack","owner":"ajm188","description":"Slack clients in golang","archived":false,"fork":false,"pushed_at":"2016-03-18T00:51:12.000Z","size":66,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T09:16:09.921Z","etag":null,"topics":["bot","go","slack"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajm188.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-29T21:48:47.000Z","updated_at":"2016-07-02T23:50:27.000Z","dependencies_parsed_at":"2022-09-26T18:41:32.897Z","dependency_job_id":null,"html_url":"https://github.com/ajm188/slack","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ajm188/slack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajm188%2Fslack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajm188%2Fslack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajm188%2Fslack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajm188%2Fslack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajm188","download_url":"https://codeload.github.com/ajm188/slack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajm188%2Fslack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260308107,"owners_count":22989804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","go","slack"],"created_at":"2025-02-01T13:48:41.276Z","updated_at":"2025-06-17T06:35:11.814Z","avatar_url":"https://github.com/ajm188.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slack\n\n[![Build Status](https://travis-ci.org/ajm188/slack.svg?branch=master)](https://travis-ci.org/ajm188/slack)\n[![Coverage Status](https://coveralls.io/repos/github/ajm188/slack/badge.svg?branch=master)](https://coveralls.io/github/ajm188/slack?branch=master)\n[![GoDoc](https://godoc.org/github.com/ajm188/slack?status.svg)](https://godoc.org/github.com/ajm188/slack)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ajm188/slack)](https://goreportcard.com/report/github.com/ajm188/slack)\n\n[![Issue Stats](http://www.issuestats.com/github/ajm188/slack/badge/issue)](http://www.issuestats.com/github/ajm188/slack)\n[![Issue Stats](http://www.issuestats.com/github/ajm188/slack/badge/pr)](http://www.issuestats.com/github/ajm188/slack)\n\n## Installation\n\n`go get github.com/ajm188/slack`\n\n## Usage\n\n### Starting the Bot\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/ajm188/slack\"\n)\n\nfunc main() {\n    bot := slack.NewBot(\"my_slack_token\")\n    err := bot.Start()\n    if err != nil {\n        fmt.Println(err)\n    }\n}\n```\n\nNote that you need to pass your Slack token to the bot, so your bot can\nauthenticate with the Slack API.\n\n### Simple Response\n\nThe design of `slack` is built around a handler pattern. The bot listens for\nincoming events from the Slack RTM API, and then invokes any handlers for that\ntype of event.\n\nA valid handler takes a reference to the bot and the event and returns a\nreference to a Message, and a Status, which tells the main loop whether or not\nto continue interacting with the RTM API.\n\n`slack` has some factory methods for constructing handlers for common\noperations, such as responding to a message or posting a reaction to a message.\nIf you need something more fine-grained, feel free to write your own.\n\nThere are also convenience methods for registering handlers specifically for\n\"message\" type events. The Bot defines instance methods `Listen` - which finds\ntext that matches the given pattern - and `Respond` which finds text that first\nmentions the bot by name and then matches the given pattern. These helper\nmethods have `Regexp` variants which can take a compiled regular expression\ndirectly instead of a string.\n\n```go\npackage main\n\n// ... imports blah, blah\n\nfunc main() {\n    bot := slack.NewBot(\"\")\n    bot.Respond(\"hi!\", slack.Respond(\"hi!\"))\n    bot.Start()\n}\n```\n\n### Adding a Reaction\n\n```go\npackage main\n\n// imports\n\nfunc main() {\n    bot := slack.NewBot(\"\")\n    bot.Listen(\"ship ?it\\\\?\", slack.React(\"shipit\"))\n    bot.Start()\n}\n```\n\n### Logging\n\n`slack` uses [logrus](https://github.com/Sirupsen/logrus) for logging. Feel\nfree to set your log level appropriately in an `init` function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajm188%2Fslack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajm188%2Fslack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajm188%2Fslack/lists"}