feat: add Slack target type for incoming webhook notifications
All checks were successful
check / check (push) Successful in 2m2s
All checks were successful
check / check (push) Successful in 2m2s
Add a new 'slack' target type that sends webhook events as formatted messages to any Slack-compatible incoming webhook URL (Slack, Mattermost, and other compatible services). Messages include event metadata (method, content type, timestamp, body size) and the payload pretty-printed in a code block. JSON payloads are automatically formatted with indentation; non-JSON payloads are shown as raw text. Large payloads are truncated at 3500 chars. Changes: - Add TargetTypeSlack constant to model_target.go - Add SlackTargetConfig struct and deliverSlack method to delivery engine - Add FormatSlackMessage (exported) for building Slack message text - Route slack targets in processDelivery switch - Handle slack type in HandleTargetCreate with webhook_url config - Add slack option to source_detail.html target creation form - Add comprehensive tests (config parsing, message formatting, delivery success/failure, routing) - Update README with slack target documentation
This commit is contained in:
@@ -92,6 +92,7 @@
|
||||
<input type="text" name="name" placeholder="Target name" required class="input text-sm flex-1">
|
||||
<select name="type" x-model="targetType" class="input text-sm w-32">
|
||||
<option value="http">HTTP</option>
|
||||
<option value="slack">Slack</option>
|
||||
<option value="database">Database</option>
|
||||
<option value="log">Log</option>
|
||||
</select>
|
||||
@@ -103,6 +104,10 @@
|
||||
<label class="text-sm text-gray-700">Max retries (0 = fire-and-forget):</label>
|
||||
<input type="number" name="max_retries" value="0" min="0" max="20" class="input text-sm w-24">
|
||||
</div>
|
||||
<div x-show="targetType === 'slack'">
|
||||
<input type="url" name="url" placeholder="https://hooks.slack.com/services/..." class="input text-sm">
|
||||
<p class="text-xs text-gray-500 mt-1">Slack or Mattermost incoming webhook URL. Payloads are pretty-printed in code blocks.</p>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary text-sm">Add Target</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user