notifier: emit Apprise-compatible body/title in webhook payload#888
Open
nathang21 wants to merge 1 commit into
Open
notifier: emit Apprise-compatible body/title in webhook payload#888nathang21 wants to merge 1 commit into
nathang21 wants to merge 1 commit into
Conversation
Apprise's REST API (apprise-api) requires a "body" field and rejects any payload without one with HTTP 400 "Payload lacks minimum requirements". Bindery's webhook payloads only carry event-specific keys (title, message, size, ...), so pointing a notification at an Apprise /notify/<key> endpoint always failed. Enrich a copy of the payload in send() with "body" (from message, falling back to title) and a default "title" of "Bindery" when absent. The change is additive: original keys are preserved, so ntfy / Home Assistant / Discord proxy consumers are unaffected. Copying avoids mutating the shared payload map that Send reuses across notifications. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Webhook notifications can't reach an Apprise instance. Apprise's REST API requires a
bodyfield and rejects any payload without one:Bindery's payloads only carry event-specific keys (
title,message,size, …) and never abody, so every POST to an Apprise/notify/<key>endpoint fails — even withBINDERY_NOTIFICATIONS_ALLOW_PRIVATE=1set (this is separate from #870; the request does reach Apprise, it's just rejected on shape).Reproduce
Apprise ignores the extra
eventType/messagekeys, confirming the fix can be purely additive.Change
In
notifier.send(), enrich a copy of the payload before marshaling:bodywhen absent — frommessage, falling back totitle(covers grab/import which carrytitle, and test/health/failure which carrymessage);titleto"Bindery"when absent.This is additive — the original keys are preserved, so ntfy / Home Assistant / Discord-proxy consumers are unaffected. A copy is used because
Sendreuses one payload map across every configured notification.Tests
TestSend_AppriseFieldscovers the three cases (title-only, message-only, explicit-body-preserved) and asserts the caller's original keys survive untouched. Existing notifier tests still pass.If you'd prefer to gate this on a notification "type" (e.g.
type == "apprise") rather than always emittingbody/title, happy to adjust.