Skip to content

Conversation

@ssddanbrown
Copy link
Member

@ssddanbrown ssddanbrown commented Dec 8, 2021

The PR tracks an initial implementation for outbound webhooks. This will adhere-to/include the following:

  • Webhooks will be managed by those that can manage application settings (Generally admin users).
  • They will take a name and endpoint to configure.
  • You can select any system event (As shown in audit log) or choose to send all events.
  • Webhooks will be POST requests with fixed-format JSON.
    • An event property will detail the event that was trigged.
    • A text property will be set where possible to provide a human readable description of the event for potential direct slack (Or slack compatible) usage.
  • No custom permission handling will be considered for this implementation.

TODO

  • Finish admin management UI.
  • Build event call logic.
  • Add example of format to the admin management UI.
  • Add ability to deactivate/activate in the management UI.
  • Mention availability of webhooks in the API docs page.
  • Define strategy for queue based calling (Optional).
  • Testing
    • Permissions
    • Calling
    • Management Interface

Queue Strategy

Defaults to sync. Can use an async queue via QUEUE_CONNECTION=sync. Will then need a queue worker via:

php artisan queue:work --sleep=3 --tries=3 --max-time=3600

Ideally will need that ran via systemd or similar, with php artisan queue:restart ran upon update.

Docs Todo

  • Create new "Notifications & Webhooks" page.
  • Detail changes needed to use database queue where performance is desired.
    • Include a systemd setup steps for a default script-installed Ubuntu setup.

Got webhook CRUD actions in place within the interface.
Quick manual test pass done, Needs automated tests.
@ssddanbrown ssddanbrown linked an issue Dec 8, 2021 that may be closed by this pull request
- Renamed to "ActivityLogger" to be more focused in usage.
- Extracted out query elements to seperate "ActivityQueries" class.
- Removed old 'addForEntity' activity method to limit activity record
  points.
To allow easy temporary de-activation without deletion or other
workarounds. Updated tests to cover.
Migrated call logic to Laravel's HTTP client for easier testing
capabilities.
@ssddanbrown ssddanbrown merged commit a3ead50 into master Dec 18, 2021
@ssddanbrown ssddanbrown deleted the webhooks branch December 18, 2021 11:40
@carlossierra311 carlossierra311 mentioned this pull request Apr 24, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Notification webhook framework

2 participants