Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Slack Slash Command Laravel Package

spatie/laravel-slack-slash-command

Build Slack slash commands in Laravel. Define handlers to validate and process incoming Slack requests, reply within 3 seconds or dispatch jobs for longer work, and send structured responses back to Slack. Includes request/response helpers and simple routing of commands.

View on GitHub
Deep Wiki
Context7

title: Responding to multiple commands weight: 3

You may choose to set up multiple slack commands. On the integrations settings on slack.com you should let them all point to the url you configured in app/config/laravel-slack-slash-command.

Image you've created two slack commands /jaime and /johnsnow

namespace App\SlashCommandHandlers;

use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;

class Jaime extends BaseHandler
{

    public function canHandle(Request $request): bool
    {
        return $request->command == 'jaime';
    }

    public function handle(Request $request): Response
    {
        return $this->respondToSlack("A Lannister always pays his debts");
    }
}
namespace App\SlashCommandHandlers;

use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;

class JohnSnow extends BaseHandler
{

    public function canHandle(Request $request): bool
    {
        return $request->command == 'johnsnow';
    }

    public function handle(Request $request): Response
    {
        return $this->respondToSlack("I know nothing");
    }
}

You'll see a response A Lannister always pays his debts after issueing the /jaime command, and I know nothing after issuing the /johnsnow command.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport