{"id":16842020,"url":"https://github.com/theckman/slackmech","last_synced_at":"2026-05-20T10:47:41.854Z","repository":{"id":57552688,"uuid":"128732905","full_name":"theckman/slackmech","owner":"theckman","description":"slackmech provides help for mechanizing request to the Slack Web/Electron UI API","archived":false,"fork":false,"pushed_at":"2019-01-21T16:08:47.000Z","size":1791,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T15:12:29.981Z","etag":null,"topics":["golang","golang-library","mechanize","slack","slack-api"],"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/theckman.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":"2018-04-09T07:36:26.000Z","updated_at":"2020-05-21T14:22:36.000Z","dependencies_parsed_at":"2022-09-26T18:50:47.908Z","dependency_job_id":null,"html_url":"https://github.com/theckman/slackmech","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theckman%2Fslackmech","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theckman%2Fslackmech/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theckman%2Fslackmech/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theckman%2Fslackmech/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theckman","download_url":"https://codeload.github.com/theckman/slackmech/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244188055,"owners_count":20412975,"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":["golang","golang-library","mechanize","slack","slack-api"],"created_at":"2024-10-13T12:44:00.441Z","updated_at":"2026-05-20T10:47:41.786Z","avatar_url":"https://github.com/theckman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slackmech\n[![License](https://img.shields.io/github/license/theckman/slackmech.svg)](https://github.com/theckman/slackmech/blob/master/LICENSE)\n[![GoDoc Page](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/theckman/slackmech)\n[![Latest Git Tag](https://img.shields.io/github/tag/theckman/slackmech.svg)](https://github.com/theckman/slackmech/releases)\n[![TravisCI master Branch Build Status](https://img.shields.io/travis/theckman/slackmech/master.svg)](https://travis-ci.org/theckman/slackmech/branches)\n[![Go Cover Test Coverage](https://gocover.io/_badge/github.com/theckman/slackmech?v0)](https://gocover.io/github.com/theckman/slackmech)\n[![Go Report Card](https://goreportcard.com/badge/github.com/theckman/slackmech)](https://goreportcard.com/report/github.com/theckman/slackmech)\n\nPackage `slackmech` is a package for mechanizing requests to the Slack API. It\nhelps imitate a web session with Slack, to present you with a session API token.\nThis token has different API access, including undocumented behaviors, to allow\nspecial features of the Web/Electron UI. This package will also abstract away\nsome of those API calls, making it easier to consume them.\n\nAs of now, the features of this project are focused towards a bot for moderating\nOpen Source Slack communities. Things will be added as they are needed to\nsupport that effort, or as contributions from others are made.\n\nThis package is still under active development.\n\n### Compatibility Notice\nThe behaviors and functions relied on by this package are largely undocumented,\nand the usage of them fall outside of any compatibility guarantees provided by\nSlack. While the functionality provided by this package is necessary, it's\nreasonable to assume it may break unexpectedly in the future.\n\nAs such, at the time of writing, it seems unlikely that this package will ever\nbe able to see a 1.0.0 release. However, efforts will be made to retain API\ncompatibility as long as possible. The package will have releases, using git\ntags, following the [Semantic Version v2.0.0 spec](https://semver.org/spec/v2.0.0.html).\n\n## License\nThis source code of this package is released under the MIT License. Please see\nthe [LICENSE](https://github.com/theckman/slackmech/blob/master/LICENSE) for the\nfull content of the license.\n\n## Usage\nTo be a respectful user of the Slack APIs, be sure to use an `*http.Client` with\na cookiejar set, preferably one that makes use of\n[persistence](https://github.com/juju/persistent-cookiejar). In our example,\nwe'll use the standard cookiejar implementation.\n\nHere we'll create a cookiekar, create an HTTP client, create a new slackmech\nclient, log in, and then use the Session Token to create a new API client:\n\n```Go\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"net/http/cookiejar\"\n\t\"os\"\n\n\t\"github.com/nlopes/slack\"\n\t\"github.com/theckman/slackmech\"\n\n\t\"golang.org/x/net/publicsuffix\"\n)\n\nfunc main() {\n\temail := os.Getenv(\"SLACK_EMAIL\")\n\tpassword := os.Getenv(\"SLACK_PASSWORD\")\n\tsubdomain := os.Getenv(\"SLACK_SUBDOMAIN\")\n\n\tcj, err := cookiejar.New(\u0026cookiejar.Options{PublicSuffixList: publicsuffix.List})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// new http client with cookiejar set\n\tclient := \u0026http.Client{\n\t\tJar: cj,\n\t}\n\n\t// don't follow redirects -- needed by slackmech\n\tclient.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\treturn http.ErrUseLastResponse\n\t}\n\n\t// new slackmech client\n\tsm, err := slackmech.New(client, subdomain)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// log in and get a new session\n\terr = sm.StartSession(email, password)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// use the slackmech SessionToken to build a new Slack API client\n\t// also pass in the HTTP client used to log in to continue using cookies\n\tapi := slack.New(sm.SessionToken(), slack.OptionHTTPClient(client))\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheckman%2Fslackmech","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheckman%2Fslackmech","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheckman%2Fslackmech/lists"}