Request Plugins
#

Request plugins are a powerful feature in Expose to simplify management of incoming requests.

Working with webhooks can be a challenge, especially when you’re dealing with a high volume of incoming requests from platforms like Paddle Billing or GitHub. Often, you’re only interested in a specific request—for example, a "transaction.paid" event—and manually searching all incoming request logs to find it can be time-consuming.

Request plugins in Expose solve this problem by allowing you to highlight and identify important aspects of incoming requests directly in the CLI and the client dashboard. This feature helps you quickly locate and inspect the exact request you’re interested in, enhancing debugging and development of workflows.

Key Features
#

Request plugins are modular components that enhance the way incoming requests are processed and displayed in Expose. They allow you to:

  • Highlight specific types of requests (e.g. certain webhook events)
  • Add custom logic to process and categorize requests
  • Easily manage, enable, or disable plugins as needed

Expose comes with a growing list of built-in plugins to handle common webhook use cases, and you can also implement your own custom plugins to suit your specific needs.

Exploring Request Plugins
#

Run the expose plugins command to view a list of all available request plugins and whether they are currently active.

expose plugins

  > Expose
   Request plugins allow you to highlight important parts about incoming
   requests in the CLI and client dashboard.
   You can learn more about them in the documentation.

 ┌──────────────────────────────────────────────────┬─────────┬────────┐
 │ Plugin                                           │ Type    │ Active │
 ├──────────────────────────────────────────────────┼─────────┼────────┤
 │ Expose\Client\Logger\Plugins\GitHubPlugin        │ Default │ ✔      │
 │ Expose\Client\Logger\Plugins\PaddleBillingPlugin │ Default │ ✔      │
 └──────────────────────────────────────────────────┴─────────┴────────┘

   Use the plugins:manage command to activate and deactivate request plugins.

Managing Plugins
#

To manage all currently available request plugins, use the following command:

expose plugins:manage

  > Expose
   Request plugins allow you to highlight important parts about incoming
   requests in the CLI and client dashboard.
   You can learn more about them in the documentation.

 ┌ Select the plugins you want to enable: ──────────────────────┐
 │ › ◻ Expose\Client\Logger\Plugins\GitHubPlugin                │
 │   ◼ Expose\Client\Logger\Plugins\PaddleBillingPlugin         │
 └──────────────────────────────────────────────────────────────┘

Remember to restart any running share commands to apply changes.

Examples
#

Built-in Plugins
#

Expose includes built-in plugins for common webhook providers.

GitHubPlugin

The plugin is supports the push, pull_request, issues and ping events received from GitHub webhooks. The event type is added to the request list in the CLI as well as the sidebar in the client dashboard.

  Shared site              expose-platform.test:443
  Dashboard                http://127.0.0.1:4040
  Public URL               https://expose-platform.eu-1.sharedwithexpose.com

  200    POST  /api/github .............. push                15:25:22  150 ms
  200    POST  /api/github .............. pull_request.opened 15:25:09  280 ms

Depending on the event type, the detailed view of a incoming request in the dashboard contains further information about the event, clearly presented in a tabular format:

PaddleBillingPlugin

The plugin extracts information relevant to the transaction from a webhook received by the Paddle Billing platform. For easy identification of an incoming request, the event_type of the request is showed in the CLI request list as well as the sidebar of the client dashboard.

  Shared site              expose-platform.test:443
  Dashboard                http://127.0.0.1:4040
  Public URL               https://expose-platform.eu-1.sharedwithexpose.com

  200    POST  /paddle-billing ............ payment_method.saved  14:51:04  53 ms
  200    POST  /paddle-billing ............ transaction.completed 14:51:03  61 ms
  200    POST  /paddle-billing ............ transaction.updated   14:51:02  65 ms

The client dashboard shows the relevant payload for further identification.

The built-in plugins are enabled by default and make it easy to start working with webhooks immediately without additional configuration.

Creating a Custom Plugin
#

If your use case isn’t covered by the built-in plugins, you can create a custom plugin using the following command:

expose make:plugin

This will guide you through setting up a new plugin and activate it.

If you think your custom plugins could be users for others as well, feel free to contribute it to the open-source repository!

Request Plugins Workflow
#

The workflow below outlines how request plugins handle incoming webhooks.

  1. A webhook request is sent to your application via an Expose server.
  2. The active plugin which matches the condition first processes the request. The plugins will be checked according to their order in the request_plugins array in the expose.php configuration file.
  3. The CLI and client dashboard highlight requests that match the plugin criteria and add relevant data, for example the event type for an GitHub webhook.