- What does spatricius/slack-unfurl-bundle do?
- It is a Symfony bundle that handles Slack link unfurling, the feature that expands posted URLs into rich preview cards inside channels. The bundle deals with incoming link_shared events, builds the unfurl payload, and makes the Slack API call so your application does not have to wire that flow manually. It is aimed at teams building Slack apps on top of Symfony who want a lightweight integration rather than a full Slack SDK.
- How do I install the Slack unfurl bundle with Composer?
- Install it with composer require spatricius/slack-unfurl-bundle and then register the bundle in your Symfony application's bundle configuration. You will also need to supply your Slack credentials, such as the bot token and signing secret, through your configuration or environment variables. Check the repository README for the exact service configuration keys before going live.
- Does this package work with Laravel?
- No, not out of the box. It is packaged as a Symfony bundle and relies on Symfony conventions and the Message component, so Laravel's service container and event system will not resolve its services automatically. Laravel developers can still read the source as a reference implementation and reproduce the link_shared handling with Laravel's HTTP client, queue, and a controller. Treat it as Symfony-first unless you are prepared to port the integration.
- Which Symfony and PHP versions are supported?
- The supported ranges are declared in the package's composer.json, so check the require constraints there before adding it to an existing project. Because the bundle is built around Symfony's Message component, you need a Symfony version that ships the Messenger component and an actively supported PHP version. Running composer why-not spatricius/slack-unfurl-bundle will quickly show any conflicts in your application.
- What Slack app configuration is required for unfurling to work?
- Your Slack app needs the link_shared event subscribed under Event Subscriptions and the domains you want to unfurl listed in the app's unfurl domains setting. The bot token must carry the scope that allows calling the unfurl API method, typically links:write. Without the matching domain entry Slack will never send the link_shared event for your links.
- Can I customize the preview card that appears in Slack?
- Yes. The bundle handles the transport and Slack API call, but the content of the preview is defined by the unfurl payload your application builds. You can shape attachments or block-style cards with titles, descriptions, images, and fields to match your product. Keep payloads small and text concise, since Slack renders them in a compact card layout.
- How do I test Slack unfurling during local development?
- Expose your local application with a tunnel such as ngrok or Symfony's own local proxy tooling and point the Slack app's request URL at it. Then post one of your registered domains in a test channel and watch the event arrive in your logs. For automated tests, mock the Slack HTTP client so you can assert the payload your code generates without hitting the real API.
- Is it safe to run in production given Slack's response timeout?
- Slack expects an HTTP 200 acknowledgment within about three seconds, and repeated timeouts can get your request URL disabled. The usual pattern is to acknowledge immediately and push the actual unfurl work onto a queue worker so slow API calls or database lookups do not block the response. Make sure your Slack API errors are logged, because failed unfurls are otherwise silent to end users.
- How do I verify that incoming requests really come from Slack?
- Slack signs each request with your app's signing secret, and you should validate that signature before processing any event. The bundle sits inside your Symfony HTTP stack, so the verification can be handled by middleware or a listener in front of the unfurl handler. Also reject stale timestamps to prevent replay attacks, and never expose the signing secret in client-side code.
- What alternatives exist and how active is this package?
- Alternatives include the official Slack Bolt framework for PHP, the Slack PHP SDK, or a small custom controller that calls the unfurl endpoint directly. This bundle's advantage is that it fits existing Symfony applications with little ceremony. Before adopting it, check the repository's recent commits, open issues, and release history to confirm it is maintained against your Symfony version.