{"id":19324875,"url":"https://github.com/spatie/laravel-slack-slash-command","last_synced_at":"2025-05-14T20:05:10.636Z","repository":{"id":37818804,"uuid":"62377978","full_name":"spatie/laravel-slack-slash-command","owner":"spatie","description":"Make a Laravel app respond to a slash command from Slack","archived":false,"fork":false,"pushed_at":"2025-02-17T09:59:04.000Z","size":496,"stargazers_count":247,"open_issues_count":2,"forks_count":46,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T02:58:11.404Z","etag":null,"topics":["laravel","notifications","php","robots","slack","slash-commands"],"latest_commit_sha":null,"homepage":"https://freek.dev/524-building-a-laravel-powered-slack-bot","language":"PHP","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/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-01T08:33:48.000Z","updated_at":"2025-04-08T13:16:19.000Z","dependencies_parsed_at":"2024-05-17T09:47:59.019Z","dependency_job_id":null,"html_url":"https://github.com/spatie/laravel-slack-slash-command","commit_stats":{"total_commits":192,"total_committers":34,"mean_commits":5.647058823529412,"dds":0.296875,"last_synced_commit":"da4a836f31eef67d305562fb4ce6d12d80add381"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-slack-slash-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-slack-slash-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-slack-slash-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-slack-slash-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-slack-slash-command/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813790,"owners_count":21165633,"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":["laravel","notifications","php","robots","slack","slash-commands"],"created_at":"2024-11-10T02:07:18.651Z","updated_at":"2025-05-14T20:05:10.609Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://spatie.be/open-source?utm_source=github\u0026utm_medium=banner\u0026utm_campaign=laravel-slack-slash-command\"\u003e\n      \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://spatie.be/packages/header/laravel-slack-slash-command/html/dark.webp\"\u003e\n        \u003cimg alt=\"Logo for laravel-slack-slash-command\" src=\"https://spatie.be/packages/header/laravel-slack-slash-command/html/light.webp\" height=\"190\"\u003e\n      \u003c/picture\u003e\n    \u003c/a\u003e\n\n\u003ch1\u003eMaking a Laravel app respond to Slack commands\u003c/h1\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-slack-slash-command.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-slack-slash-command)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/spatie/laravel-slack-slash-command/master.svg?style=flat-square)](https://travis-ci.org/spatie/laravel-slack-slash-command)\n[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/laravel-slack-slash-command.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/laravel-slack-slash-command)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-slack-slash-command.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-slack-slash-command)\n    \n\u003c/div\u003e\n\nThis package makes it easy to make your Laravel app respond to [Slack's Slash commands](https://api.slack.com/slash-commands). \n\nOnce you've setup your Slash command over at Slack and installed this package into a Laravel app you can create handlers that can handle a slash command. Here's an example of such a handler that will send a response back to slack.\n\n```php\nnamespace App\\SlashCommandHandlers;\n\nuse App\\SlashCommand\\BaseHandler;\nuse Spatie\\SlashCommand\\Request;\nuse Spatie\\SlashCommand\\Response;\n\nclass CatchAll extends BaseHandler\n{\n    /**\n     * If this function returns true, the handle method will get called.\n     *\n     * @param \\Spatie\\SlashCommand\\Request $request\n     *\n     * @return bool\n     */\n    public function canHandle(Request $request): bool\n    {\n        return true;\n    }\n\n    /**\n     * Handle the given request. Remember that Slack expects a response\n     * within three seconds after the slash command was issued. If\n     * there is more time needed, dispatch a job.\n     * \n     * @param \\Spatie\\SlashCommand\\Request $request\n     * \n     * @return \\Spatie\\SlashCommand\\Response\n     */\n    public function handle(Request $request): Response\n    {\n        return $this-\u003erespondToSlack(\"You have typed this text: `{$request-\u003etext}`\");\n    }\n}\n```\n\nSpatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-slack-slash-command.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-slack-slash-command)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\ncomposer require spatie/laravel-slack-slash-command\n```\n\nThis service provider must be installed.\n\n```php\n// config/app.php\n'providers' =\u003e [\n    ...\n    Spatie\\SlashCommand\\SlashCommandServiceProvider::class,\n];\n```\n\nYou can publish the config-file with:\n\n```bash\nphp artisan vendor:publish --provider=\"Spatie\\SlashCommand\\SlashCommandServiceProvider\"\n```\n\nThis is the contents of the published file:\n\n```php\nreturn [\n\n    /*\n     * At the integration settings over at Slack you can configure the url to which the \n     * slack commands are posted. Specify the path component of that url here. \n     * \n     * For `http://example.com/slack` you would put `slack` here.\n     */\n    'url' =\u003e 'slack',\n\n    /*\n     * The token generated by Slack with which to verify if a incoming slash command request is valid.\n     */\n    'token' =\u003e env('SLACK_SLASH_COMMAND_VERIFICATION_TOKEN'),\n    \n    /*\n     * The signing_secret generated by Slack with which to verify if a incoming slash command request is valid.\n     */\n    'signing_secret' =\u003e env('SLACK_SIGNING_SECRET'),\n\n    /*\n     * Verify requests from slack with signing_secret signature\n     */\n    'verify_with_signing' =\u003e false,\n\n    /*\n     * The handlers that will process the slash command. We'll call handlers from top to bottom\n     * until the first one whose `canHandle` method returns true.\n     */\n    'handlers' =\u003e [\n        //add your own handlers here\n\n\n        //this handler will display instructions on how to use the various commands.\n        Spatie\\SlashCommand\\Handlers\\Help::class,\n\n        //this handler will respond with a `Could not handle command` message.\n        Spatie\\SlashCommand\\Handlers\\CatchAll::class,\n    ],\n];\n\n```\nChange `verify_with_signing` parameter to verify requests from slack by `signing_secret`:\n```php\n// config/laravel-slack-slash-command.php\n'verify_with_signing' =\u003e true\n```\n\n## Documentation\nYou'll find the documentation on [https://docs.spatie.be/laravel-slack-slash-command](https://docs.spatie.be/laravel-slack-slash-command).\n\nFind yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-slack-slash-command/issues), we'll try to address it as soon as possible.\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n### Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Postcardware\n\nYou're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.\n\nOur address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.\n\nWe publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\nThe message and attachment functionalities were heavily inspired on [Regan McEntyre's Slack package](https://github.com/maknz/slack).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-slack-slash-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-slack-slash-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-slack-slash-command/lists"}