This template repo is a base Laravel application with additional Slack app support added in.
Most existing features or tools will live separately from each other. If you're only going to add a slash command, there's no need to remove the other classes you aren't using.
Once you've made your own repo using this template, you must enter your app's secrets (see api.slack.com/apps for these).
- Add your
SLACK_APP_SIGNING_SECRETto.env - Add your
SLACK_BOT_USER_TOKENto.env
app/Http/Middleware/SlackApiVerification.php
This middleware (registered as slack.verify) is already added to the slack. API route group. It facilitates message signature verification if you'll be receiving requests from Slack, such as event or interaction payloads.
app/Slack/BlockKitMessage.php
This class is used to construct Block Kit messages and payloads for use elsewhere in the app.
app/Slack/SlackClient.php
A simple API calling client with some built-in methods and helpers. This client assumes you'll be using a bot user token for authentication.
With this client is a custom error class at app/Exceptions/SlackApiError.php. This can be used to catch errors in your API calls as separate from an error with the call itself.
app/Slack/Helpers.php
A simple class with only one method to help format URLs in messages. However, this class is a good place to put future general Slack-related helper methods as you build your app.
For command /foo:
- Route defined in
api.phpasslack.slash.foo - Handler in
app/Http/Controllers/Slack/SlashCommandController.php@foo
- Route defined in
api.phpasslack.interaction - Handler in
app/Http/Controllers/Slack/InteractionController.php
- Route defined in
api.phpasslack.event - Handler in
app/Http/Controllers/Slack/EventController.php