Use Apprise for notifications

Peter Dimitrova year ago

I can confirm that clicking "Test channels" creates a POST request to /api/notifications/test/sms with empty result - no error, no successful message. I enabled debugging at server level and see a lot of entries, one that stands up is:

DEBUG: failed all content of http channel EOF=true AsyncContentProducer@1d486122[r=ErrorContent [org.eclipse.jetty.util.StaticException: Unconsumed content],t=ErrorContent [org.eclipse.jetty.util.StaticException: Unconsumed content],i=null,error=false,c=HttpChannelOverHttp@9c04b07{s=HttpChannelState@4cb5b916{s=HANDLING rs=COMPLETING os=OPEN is=IDLE awp=false se=false i=false al=0},r=12,c=false/false,a=HANDLING,uri=http://localhost:8082/api/notifications/test/sms,age=137}]

After that it creates the headers for the response and returns "NO_CONTENT" which is the behavior I can observe via the browser.

My config file is as follows:

        <entry key='logger.level'>all</entry>
        <entry key='notificator.types'>web,mail,sms</entry>
        <entry key='sms.http.url'>https://sms-gateway-url/</entry>
        <entry key='sms.http.template'>{"topic": "{phone}","message": "{message}"}</entry>

No packets are received on the gateway at all.

alextruppela year ago

I have figured out the issue. After 2 hours looking at the code and running tests on my laptop, I found the culprit. This line checks if the user has a phone number set before sending SMS notifications, even if the SMS notification is sent over HTTP (and thus does not necessarily require a phone number). Once I set a phone number in Settings -> Account -> Preferences drop-down, HTTP requests using the SMS notification type started working.

Therefore, I would suggest that this check be removed, or at least changed in some reasonable way, so that this pitfall is avoided (I understand why the check is there, it's just that in this case we're "abusing" the SMS notification to send HTTP requests, so the check makes less sense).

Anton Tananaeva year ago

SMS notifications require a phone number, so it doesn't make sense to remove that check. What you're doing is basically a hack and the right thing would be to implement a non-SMS notification option.

alextruppela year ago

I agree entirely with everything you just said. For now I'll continue to use this workaround until this is eventually done.