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.
On top of adding attachments to your messages, you can also make your attachments interactive.
Take a look at this response on Slack:
This is how you would build that up
$this->respondToSlack('')
->withAttachment(Attachment::create()
->setColor('good')
->setText('This is good!')
->setFallback('good-message')
->setCallbackId('good-1')
->addAction(Action::create('cool button', 'A Cool Button', 'button'))
);
Make sure you use the correct classes:
use Spatie\SlashCommand\Attachment;
use Spatie\SlashCommand\AttachmentField;
Take a look at Slacks documentation on interactive messages to learn what's possible. Please note that at this time only buttons are supported, and menus are not.
How can I help you explore Laravel packages today?