WebhookBackend class

A FeedbackBackend that POSTs feedback as JSON to an HTTPS webhook URL.

Compatible with Slack incoming webhooks, Discord webhooks, n8n, Zapier, Make, and any custom HTTP endpoint.

final backend = WebhookBackend(
  url: 'https://hooks.slack.com/services/...',
  payloadBuilder: (entry) => {
    'text': '*${entry.category}* — ${entry.message}',
  },
);
Implemented types

Constructors

WebhookBackend({required String url, Map<String, String> headers = const {}, Map<String, dynamic> payloadBuilder(FeedbackEntry)?, Duration timeout = const Duration(seconds: 15), Client? httpClient})
Creates a WebhookBackend.

Properties

hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Additional HTTP headers merged with Content-Type: application/json.
final
payloadBuilder Map<String, dynamic> Function(FeedbackEntry)?
Optional factory that builds a custom JSON payload from FeedbackEntry.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
Request timeout. Default: 15 seconds.
final
url String
The HTTPS endpoint that receives the feedback payload.
final

Methods

dispose() → void
Closes the underlying HTTP client.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
submit(FeedbackEntry entry) Future<void>
Sends entry to the backend.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited