{"id":15108548,"url":"https://github.com/pvzig/slackkit","last_synced_at":"2025-09-27T07:31:35.621Z","repository":{"id":44799448,"uuid":"43465902","full_name":"pvzig/SlackKit","owner":"pvzig","description":"Build Slack apps, in Swift","archived":true,"fork":false,"pushed_at":"2022-12-02T13:54:50.000Z","size":80008,"stargazers_count":1019,"open_issues_count":0,"forks_count":139,"subscribers_count":19,"default_branch":"main","last_synced_at":"2024-12-28T16:02:51.066Z","etag":null,"topics":["chatbots","server-side-swift","slack","slackkit","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/pvzig.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":"2015-09-30T23:28:39.000Z","updated_at":"2024-12-23T21:04:12.000Z","dependencies_parsed_at":"2022-08-05T17:00:13.048Z","dependency_job_id":null,"html_url":"https://github.com/pvzig/SlackKit","commit_stats":null,"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvzig%2FSlackKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvzig%2FSlackKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvzig%2FSlackKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvzig%2FSlackKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvzig","download_url":"https://codeload.github.com/pvzig/SlackKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234410111,"owners_count":18828142,"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":["chatbots","server-side-swift","slack","slackkit","swift"],"created_at":"2024-09-25T22:03:39.758Z","updated_at":"2025-09-27T07:31:25.610Z","avatar_url":"https://github.com/pvzig.png","language":"Swift","readme":"# **This library is no longer under active development.**\n\n## SlackKit\n\n### Installation\n\n#### Swift Package Manager\n\nAdd `SlackKit` to your `Package.swift`\n\n```swift  \nlet package = Package(\n\tdependencies: [\n\t\t.package(url: \"https://github.com/pvzig/SlackKit.git\", .upToNextMinor(from: \"4.6.0\"))\n\t]\n)\n```\n\n**When built using Swift Package Manager, SlackKit includes the [vapor websocket framework](https://github.com/vapor/websocket) by default which requires libressl.**\n\nYou can install it with [homebrew](https://brew.sh): `brew install libressl`\n\nFor additional details, see the [SKRTMAPI readme](https://github.com/pvzig/SlackKit/tree/master/SKRTMAPI#swift-package-manager).\n\n#### Carthage\n\nAdd `SlackKit` to your `Cartfile`:\n\n```\ngithub \"pvzig/SlackKit\"\n```\n\n**SlackKit is now using .xcframeworks. When building your dependencies with carthage, please specify a platform: `carthage bootstrap --use-xcframeworks --platform macos`**\n\n#### CocoaPods\nAdd `SlackKit` to your `Podfile`:\n\n```\npod 'SlackKit'\n```\n\n### Usage\nTo use the library in your project import it:\n\n```swift\nimport SlackKit\n```\n\n#### The Basics\nCreate a bot user with an API token:\n\n```swift\nimport SlackKit\n\nlet bot = SlackKit()\nbot.addRTMBotWithAPIToken(\"xoxb-SLACK-BOT-TOKEN\")\n// Register for event notifications\nbot.notificationForEvent(.message) { (event, _) in\n\t// Your bot logic here\n\tprint(event.message)\n}\n```\n\nor create a ready-to-launch Slack app with your [application’s `Client ID` and `Client Secret`](https://api.slack.com/apps):\n\n```swift\nimport SlackKit\n\nlet bot = SlackKit()\nlet oauthConfig = OAuthConfig(clientID: \"CLIENT_ID\", clientSecret: \"CLIENT_SECRET\")\nbot.addServer(oauth: oauthConfig)\n```\n\nor just make calls to the Slack Web API:\n\n```swift\nimport SlackKit\n\nlet bot = SlackKit()\nbot.addWebAPIAccessWithToken(\"xoxb-SLACK-BOT-TOKEN\")\nbot.webAPI?.authenticationTest(success: { (success) in\n\tprint(success)\n}, failure: nil)\n\n```\n\n#### Slash Commands\nAfter [configuring your slash command in Slack](https://my.slack.com/services/new/slash-commands) (you can also provide slash commands as part of a [Slack App](https://api.slack.com/slack-apps)), create a route, response middleware for that route, and add it to a responder:\n\n```swift\nlet slackkit = SlackKit()\nlet middleware = ResponseMiddleware(token: \"SLASH_COMMAND_TOKEN\", response: SKResponse(text: \"👋\"))\nlet route = RequestRoute(path: \"/hello\", middleware: middleware)\nlet responder = SlackKitResponder(routes: [route])\nslackkit.addServer(responder: responder)\n```\nWhen a user enters that slash command, it will hit your configured route and return the response you specified.\n\n#### Message Buttons\nAdd [message buttons](https://api.slack.com/docs/message-buttons) to your responses for additional interactivity.\n\nTo send messages with actions, add them to an attachment and send them using the Web API:\n\n```swift\nlet helloAction = Action(name: \"hello\", text: \"🌎\")\nlet attachment = Attachment(fallback: \"Hello World\", title: \"Welcome to SlackKit\", callbackID: \"hello_world\", actions: [helloAction])\nslackkit.webAPI?.sendMessage(channel: \"CXXXXXX\", text: \"\", attachments: [attachment], success: nil, failure: nil)\n```\n\nTo respond to message actions, add a `RequestRoute` with `MessageActionMiddleware` using your app’s verification token to your `SlackKitResponder`:\n\n```swift\nlet response = ResponseMiddleware(token: \"SLACK_APP_VERIFICATION_TOKEN\", response: SKResponse(text: \"Hello, world!\"))\nlet actionRoute = MessageActionRoute(action: helloAction, middleware: response)\nlet actionMiddleware = MessageActionMiddleware(token: \"SLACK_APP_VERIFICATION_TOKEN\", routes:[actionRoute])\nlet actions = RequestRoute(path: \"/actions\", middleware: actionMiddleware)\nlet responder = SlackKitResponder(routes: [actions])\nslackkit.addServer(responder: responder)\n```\n\n#### OAuth\nSlack has [many different oauth scopes](https://api.slack.com/docs/oauth-scopes) that can be combined in different ways. If your application does not request the proper OAuth scopes, your API calls will fail. \n\nIf you authenticate using OAuth and the Add to Slack or Sign in with Slack buttons this is handled for you.\n\nFor local development of things like OAuth, slash commands, and message buttons, you may want to use a tool like [ngrok](https://ngrok.com).\n#### Advanced Usage\nDon’t need the whole banana? Want more control over the low-level implementation details? Use the extensible frameworks SlackKit is built on:\n\n| Framework        | Description |\n| ------------- |-------------  |\n| **[SKClient](https://github.com/pvzig/SlackKit/tree/master/SKClient)** | Write your own client implementation|\n| **[SKRTMAPI](https://github.com/pvzig/SlackKit/tree/master/SKRTMAPI)**     | Connect to the Slack RTM API|\n| **[SKServer](https://github.com/pvzig/SlackKit/tree/master/SKServer)**      | Spin up a server for a Slack app|\n| **[SKWebAPI](https://github.com/pvzig/SlackKit/tree/master/SKWebAPI)** | Access the Slack Web API|\n\n### Examples\nYou can find the source code for several example applications [here](https://github.com/pvzig/SlackKit/tree/master/Examples).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvzig%2Fslackkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvzig%2Fslackkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvzig%2Fslackkit/lists"}