{"id":19324827,"url":"https://github.com/spatie/interactive-slack-notification-channel","last_synced_at":"2025-05-08T21:16:23.687Z","repository":{"id":41309604,"uuid":"331406640","full_name":"spatie/interactive-slack-notification-channel","owner":"spatie","description":"Send interactive Slack notifications in Laravel apps","archived":false,"fork":false,"pushed_at":"2025-04-08T12:08:27.000Z","size":159,"stargazers_count":62,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-08T21:16:15.382Z","etag":null,"topics":["api","interactive","laravel","notifications","php"],"latest_commit_sha":null,"homepage":"https://spatie.be/open-source","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":".github/FUNDING.yml","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},"funding":{"github":"spatie"}},"created_at":"2021-01-20T19:14:47.000Z","updated_at":"2025-04-08T12:08:31.000Z","dependencies_parsed_at":"2025-01-02T13:10:34.704Z","dependency_job_id":"94852458-ce50-4ee5-9753-8474d35f372a","html_url":"https://github.com/spatie/interactive-slack-notification-channel","commit_stats":{"total_commits":64,"total_committers":4,"mean_commits":16.0,"dds":0.15625,"last_synced_commit":"ebd01c0a81919085a915ba8963569f54e5c281e0"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Finteractive-slack-notification-channel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Finteractive-slack-notification-channel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Finteractive-slack-notification-channel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Finteractive-slack-notification-channel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/interactive-slack-notification-channel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149620,"owners_count":21861740,"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":["api","interactive","laravel","notifications","php"],"created_at":"2024-11-10T02:06:57.274Z","updated_at":"2025-05-08T21:16:23.649Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie"],"categories":[],"sub_categories":[],"readme":"# Send interactive Slack notifications in Laravel apps\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/interactive-slack-notification-channel.svg?style=flat-square)](https://packagist.org/packages/spatie/interactive-slack-notification-channel)\n![Tests](https://github.com/spatie/interactive-slack-notification-channel/workflows/Tests/badge.svg)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/interactive-slack-notification-channel.svg?style=flat-square)](https://packagist.org/packages/spatie/interactive-slack-notification-channel)\n\nThis package allows you to send interactive Slack notifications. Here's how such a notification could look like\n\n\u003cimg src=\"https://github.com/spatie/interactive-slack-notification-channel/blob/main/docs/images/notification.png\" width=\"650px\" /\u003e\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/interactive-slack-notification-channel.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/interactive-slack-notification-channel)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can\nsupport 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.\nYou'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards\non [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/interactive-slack-notification-channel\n```\n\n## Usage\n\nIn your `Notifiable` classes you should add a method named `routeNotificationForInteractiveSlack` that returns an array with the\nAPI token, an optionally the channel name\n\n```php\npublic function routeNotificationForInteractiveSlack()\n{\n    return [\n        'token' =\u003e 'xoxp-slack-token',\n        'channel' =\u003e '#general' // this is optional\n    ];\n}\n```\n\n### Replying to message threads\n\nLet's assume you want your application to send a Slack notification when an order gets placed. You also want any\nsubsequent messages about the order be place in the same thread.\n\nUsing the SlackApi channels you can retrieve the API response from Slack's `chat.postMessage` method. With this response\nyou could post messages on other events that happen on the order, such as order paid, shipped, closed, etc.\n\nHere's an example:\n\n```php\nuse Spatie\\InteractiveSlackNotificationChannel\\Messages\\SlackMessage\n\npublic function toInteractiveSlack($notifiable)\n{\n    return (new SlackMessage)-\u003econtent('A new order has been placed');\n}\n\npublic function interactiveSlackResponse(array $response)\n{    \n    $this-\u003eorder-\u003eupdate(['slack_thread_ts' =\u003e $response['ts']]);\n}\n```\n\nIn your order paid event you can have\n\n```php\nuse Spatie\\InteractiveSlackNotificationChannel\\Messages\\SlackMessage;\nuse Spatie\\InteractiveSlackNotificationChannel\\Messages\\SlackAttachment;\n\npublic function toInteractiveSlack($notifiable)\n{\n    $order = $this-\u003eorder;\n\n    return (new SlackMessage)\n        -\u003esuccess()\n        -\u003econtent('Order paid')\n        -\u003ethreadTimestamp($order-\u003eslack_thread_ts)\n        -\u003eattachment(function(SlackAttachment $attachment) use ($order) {\n           $attachment\n                -\u003etitle(\"Order $order-\u003ereference has been paid for.\")\n                -\u003econtent('Should now be processed.')\n                -\u003eaction('View Order', route('orders', $order-\u003ereference));\n       });\n}\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\nSome parts of the code and readme are based on [this package](https://github.com/beyondcode/slack-notification-channel).\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%2Finteractive-slack-notification-channel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Finteractive-slack-notification-channel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Finteractive-slack-notification-channel/lists"}