All Projects → spatie → Laravel Slack Slash Command

spatie / Laravel Slack Slash Command

Licence: mit
Make a Laravel app respond to a slash command from Slack

Projects that are alternatives of or similar to Laravel Slack Slash Command

Server Monitor App
A PHP application to monitor the health of your servers
Stars: ✭ 141 (-34.42%)
Mutual labels:  laravel, slack, notifications
Laravel Failed Job Monitor
Get notified when a queued job fails
Stars: ✭ 582 (+170.7%)
Mutual labels:  laravel, slack, notifications
Project
⭐️ Antares Project Application Skeleton. This is the very first place you should start. It allows you to create a brand new awesome project in easy few steps.
Stars: ✭ 84 (-60.93%)
Mutual labels:  laravel, notifications
Gocd Slack Build Notifier
GoCD (gocd.org) plugin to push build notifications to Slack
Stars: ✭ 96 (-55.35%)
Mutual labels:  slack, notifications
Tfsnotificationrelay
An extensible plugin for TFS that sends notifications to Slack, HipChat and IRC
Stars: ✭ 120 (-44.19%)
Mutual labels:  slack, notifications
Notifier
NO LIBRARIES socket per page bridge for your Laravel application. (CLIENT PART INCLUDED)
Stars: ✭ 57 (-73.49%)
Mutual labels:  laravel, notifications
Laravel Console Logger
Logging and Notifications for Laravel Console Commands.
Stars: ✭ 79 (-63.26%)
Mutual labels:  laravel, notifications
Statusok
Monitor your Website and APIs from your Computer. Get Notified through Slack, E-mail when your server is down or response time is more than expected.
Stars: ✭ 1,522 (+607.91%)
Mutual labels:  slack, notifications
Laravel Notification
Example package for using the (still under development) Messages API from Nexmo as a notification channel in Laravel
Stars: ✭ 44 (-79.53%)
Mutual labels:  laravel, notifications
Laravel Fcm
Firebase Cloud Messaging (FCM) sender for Laravel
Stars: ✭ 129 (-40%)
Mutual labels:  laravel, notifications
Health
Laravel Health Panel
Stars: ✭ 1,774 (+725.12%)
Mutual labels:  laravel, notifications
Laravel Fcm
🌐 A Laravel package to send Push Notifications to one or many devices of the user.
Stars: ✭ 56 (-73.95%)
Mutual labels:  laravel, notifications
Craft Brief
Quick, easy, and customizable user-group notifications for Craft CMS.
Stars: ✭ 47 (-78.14%)
Mutual labels:  slack, notifications
Laralack
A Slack clone written in PHP & Laravel framework
Stars: ✭ 82 (-61.86%)
Mutual labels:  laravel, slack
Synology Notifications
Synology notifications service
Stars: ✭ 47 (-78.14%)
Mutual labels:  slack, notifications
Ravenx
Notification dispatch library for Elixir applications
Stars: ✭ 100 (-53.49%)
Mutual labels:  slack, notifications
Yfiton
Cross-platform CLI utility command for sending notifications using well-known or modern communication services
Stars: ✭ 142 (-33.95%)
Mutual labels:  slack, notifications
Laravel Smsgateway Notification Channel
SMS Gateway notification channel for Laravel
Stars: ✭ 13 (-93.95%)
Mutual labels:  laravel, notifications
Builder
Prepare your Laravel apps incredibly fast, with various commands, services, facades and boilerplates.
Stars: ✭ 1,009 (+369.3%)
Mutual labels:  laravel, notifications
Facebook
📨 Facebook Notifications Channel for Laravel
Stars: ✭ 120 (-44.19%)
Mutual labels:  laravel, notifications

Make a Laravel app respond to a slash command from Slack

Latest Version on Packagist MIT Licensed Build Status Quality Score StyleCI Total Downloads

This package makes it easy to make your Laravel app respond to Slack's Slash commands.

Once 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.

namespace App\SlashCommandHandlers;

use App\SlashCommand\BaseHandler;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;

class CatchAll extends BaseHandler
{
    /**
     * If this function returns true, the handle method will get called.
     *
     * @param \Spatie\SlashCommand\Request $request
     *
     * @return bool
     */
    public function canHandle(Request $request): bool
    {
        return true;
    }

    /**
     * Handle the given request. Remember that Slack expects a response
     * within three seconds after the slash command was issued. If
     * there is more time needed, dispatch a job.
     * 
     * @param \Spatie\SlashCommand\Request $request
     * 
     * @return \Spatie\SlashCommand\Response
     */
    public function handle(Request $request): Response
    {
        return $this->respondToSlack("You have typed this text: `{$request->text}`");
    }
}

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We 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. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/laravel-slack-slash-command

This service provider must be installed.

// config/app.php
'providers' => [
    ...
    Spatie\SlashCommand\SlashCommandServiceProvider::class,
];

You can publish the config-file with:

php artisan vendor:publish --provider="Spatie\SlashCommand\SlashCommandServiceProvider"

This is the contents of the published file:

return [

    /*
     * At the integration settings over at Slack you can configure the url to which the 
     * slack commands are posted. Specify the path component of that url here. 
     * 
     * For `http://example.com/slack` you would put `slack` here.
     */
    'url' => 'slack',

    /*
     * The token generated by Slack with which to verify if a incoming slash command request is valid.
     */
    'token' => env('SLACK_SLASH_COMMAND_VERIFICATION_TOKEN'),
    
    /*
     * The signing_secret generated by Slack with which to verify if a incoming slash command request is valid.
     */
    'signing_secret' => env('SLACK_SIGNING_SECRET'),

    /*
     * Verify requests from slack with signing_secret signature
     */
    'verify_with_signing' => false,

    /*
     * The handlers that will process the slash command. We'll call handlers from top to bottom
     * until the first one whose `canHandle` method returns true.
     */
    'handlers' => [
        //add your own handlers here


        //this handler will display instructions on how to use the various commands.
        Spatie\SlashCommand\Handlers\Help::class,

        //this handler will respond with a `Could not handle command` message.
        Spatie\SlashCommand\Handlers\CatchAll::class,
    ],
];

Change verify_with_signing parameter to verify requests from slack by signing_secret:

// config/laravel-slack-slash-command.php
'verify_with_signing' => true

Documentation

You'll find the documentation on https://docs.spatie.be/laravel-slack-slash-command.

Find 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, we'll try to address it as soon as possible.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Postcardware

You'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.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

The message and attachment functionalities were heavily inspired on Regan McEntyre's Slack package.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].