{"id":1917,"url":"https://github.com/uetcis/PerfectSlackAPIClient","last_synced_at":"2025-08-02T05:33:07.959Z","repository":{"id":63921235,"uuid":"117382622","full_name":"uetcis/PerfectSlackAPIClient","owner":"uetcis","description":"A Slack API Client for the Perfect Server-Side Swift Framework","archived":false,"fork":false,"pushed_at":"2019-06-21T06:39:12.000Z","size":226,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T06:37:32.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"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/uetcis.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-01-13T22:14:39.000Z","updated_at":"2019-12-01T02:32:39.000Z","dependencies_parsed_at":"2023-01-14T14:15:38.082Z","dependency_job_id":null,"html_url":"https://github.com/uetcis/PerfectSlackAPIClient","commit_stats":null,"previous_names":["uetcis/perfectslackapiclient","weitcis/perfectslackapiclient","captainyukinoshitahachiman/perfectslackapiclient"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/uetcis/PerfectSlackAPIClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uetcis%2FPerfectSlackAPIClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uetcis%2FPerfectSlackAPIClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uetcis%2FPerfectSlackAPIClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uetcis%2FPerfectSlackAPIClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uetcis","download_url":"https://codeload.github.com/uetcis/PerfectSlackAPIClient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uetcis%2FPerfectSlackAPIClient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339405,"owners_count":24234544,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-01-05T20:15:58.952Z","updated_at":"2025-08-02T05:33:07.722Z","avatar_url":"https://github.com/uetcis.png","language":"Swift","funding_links":[],"categories":["SDK"],"sub_categories":["Unofficial"],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/SvenTiigi/PerfectSlackAPIClient/gh-pages/readMeAssets/logo.png\" alt=\"logo\"\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/badge/Swift-4.0-orange.svg\" alt=\"Swift 3.2\"\u003e\n\t\u003c/a\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/platform-macOS%20%7C%20Linux-yellow.svg\" alt=\"Platform\"\u003e\n\t\u003ca href=\"https://sventiigi.github.io/PerfectSlackAPIClient\" target=\"_blank\"\u003e\n\t\t\u003cimg src=\"https://github.com/SvenTiigi/PerfectSlackAPIClient/blob/gh-pages/badge.svg\" alt=\"Docs\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://twitter.com/SvenTiigi\" target=\"_blank\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/badge/contact-@SvenTiigi-blue.svg\" alt=\"@SvenTiigi\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\nPerfectSlackAPIClient is an API Client to access the [Slack API](https://api.slack.com) from your [Perfect Server Side Swift](https://github.com/PerfectlySoft/Perfect) application. It is build on top of [PerfectAPIClient](https://github.com/SvenTiigi/PerfectAPIClient), a network abstraction layer to perform network requests from your Perfect Server Side Swift application\n\n# Installation\nTo integrate using Apple's [Swift Package Manager](https://swift.org/package-manager/), add the following as a dependency to your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/SvenTiigi/PerfectSlackAPIClient.git\", from: \"1.0.0\")\n```\nHere's an example `PackageDescription`:\n\n```swift\n// swift-tools-version:4.0\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyPackage\",\n    products: [\n        .library(\n            name: \"MyPackage\",\n            targets: [\"MyPackage\"]\n        )\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/SvenTiigi/PerfectSlackAPIClient.git\", from: \"1.0.0\")\n    ],\n    targets: [\n        .target(\n            name: \"MyPackage\",\n            dependencies: [\"PerfectSlackAPIClient\"]\n        ),\n        .testTarget(\n            name: \"MyPackageTests\",\n            dependencies: [\"MyPackage\", \"PerfectSlackAPIClient\"]\n        )\n    ]\n)\n```\n\n# Setup\nIn order to send a message to your Slack-Channel, you have to generate a `Webhook URL` for your Slack-Workspace.\nCheck out the Slack API [Hello world example](https://api.slack.com/tutorials/slack-apps-hello-world). After you successfully generated a Slack Webhook URL you can configure the `SlackAPIClient`.\n\n```swift\n// Configure the Webhook URL\nSlackAPIClient.Configuration.webhookURL = \"YOUR_WEBHOOK_URL\"\n```\n\nIt is recommend to set the Webhook URL in your initialization code just before you start your `PerfectHTTPServer`.\n\n# Usage\nThe following example demonstrates how to send a `SlackMessage`.\n\n```swift\nimport PerfectAPIClient\nimport PerfectSlackAPIClient\n\n// Initialize SlackMessage\nvar message = SlackMessage()\nmessage.text = \"Hello Developer\".toMarkdown(format: .code)\n\n// Initialize SlackAttachment\nvar attachment = SlackAttachment()\nattachment.title = \"Mindblown 🤯\"\nattachment.imageURL = \"https://media.giphy.com/media/Um3ljJl8jrnHy/giphy.gif\"\n\n// Add the attachment to the message\nmessage.attachments = [attachment]\n\n// Send SlackMessage\nSlackAPIClient.send(message).request { (result: APIClientResult\u003cAPIClientResponse\u003e) in\n    result.analysis(success: { (response: APIClientResponse) in\n        // Check out your Slack-Channel 😎\n        print(response.payload) // \"ok\"\n    }, failure: { (error: APIClientError) in\n        // SlackMessage could not be sent 😱\n        // Perform error.analysis(....) to get more information\n    })\n}\n```\n\nFore more details on `APIClientResult`, `APIClientResponse` and error handling check out [PerfectAPIClient](https://github.com/SvenTiigi/PerfectAPIClient).\n\n# SlackMessage\nThe `SlackMessage` offers two important features which will be explained in the upcoming sections. \n\n### Message Builder Preview\nYou can generate a [Slack Message Builder](https://api.slack.com/docs/messages/builder) URL from your `SlackMessage` to get a brief look of how your message will be presented in your Slack-Channel.\n\n```swift\n// Initialize SlackMessage\nlet message = SlackMessage(text: \"Posted via PerfectSlackAPIClient\")\n\n// Print Slack Message Builder Preview URL\nprint(message.messageBuilderPreviewURL)\n```\n\nThis example will generate the following url\n\n[https://api.slack.com/docs/messages/builder?msg=%7B%22text%22:%22Posted%20via%20PerfectSlackAPIClient%22%7D](https://api.slack.com/docs/messages/builder?msg=%7B%22text%22:%22Posted%20via%20PerfectSlackAPIClient%22%7D)\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/SvenTiigi/PerfectSlackAPIClient/gh-pages/readMeAssets/message_builder_example.png\" alt=\"Message Builder Example Preview\"\u003e\n\u003c/p\u003e\n\n### Send\nAs an alternative way of sendind a `SlackMessage`, the object itself has a convienence function `send` to just send and forget or supply `success` and `failure` closure.\n\n```swift\n// Initialize SlackMessage\nlet message = SlackMessage(text: \"Foo Bar\")\n\n// Send and forget\nmessage.send()\n\n// Success and failure closure\nmessage.send(success: { (response: APIClientResponse) in\n    // Success\n}, failure: { (error: APIClientError) in\n    // Failure\n})\n```\n\n# Slack Messages API\nAll properties are fully documented with the Slack Messages API definition. The complete documentation can be found at [https://api.slack.com/docs/messages](https://api.slack.com/docs/messages).\n\n# Dependencies\nPerfectSlackAPIClient is using the following dependencies:\n\n* [PerfectAPIClient](https://github.com/SvenTiigi/PerfectAPIClient)\n\n# Contributing\nContributions are very welcome 🙌 🤓\n\n# To-Do\n- [ ] Integrate the full Slack API\n- [ ] Improve Unit-Tests\n- [ ] Add Travis CI\n- [ ] Add Github-Pages Jazzy documentation\n\n# License\n\n```\nMIT License\n\nCopyright (c) 2018 Sven Tiigi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuetcis%2FPerfectSlackAPIClient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuetcis%2FPerfectSlackAPIClient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuetcis%2FPerfectSlackAPIClient/lists"}