Support for apprise

I've decided to embark on a project to get support into Hubitat for apprise. You can find info here: GitHub - caronc/apprise-api: A lightweight REST framework that wraps the Apprise Notification Library

I'm going to have to ask a lot of questions as I work on this. I like apprise-api because it can be a docker and can be run on a VM, or any small computer. It has support for 50 different notification protocols, including pretty much everything I could imagine. It even supports Emby if I want to have Hubitat send notifications to me as I watch TV.

I started copying an existing driver to modify to get a quick start. Now I have my first question :slight_smile:

I have a curl command that I can run and it works great:

curl -X POST -H "Content-Type: application/json" \
http://192.168.10.31:8000/get/abc123

How can I create something similar using: asynchttpPost

It seems that I should be able to do this.

thanks
david

I got a bit further.

I can send a message via apprise-api with the following bit:

try {
def postParams = [
uri: "http://192.168.10.236:8000/notify/abc456",
requestContentType: 'application/json',
contentType: 'application/json',
// headers: ['CustomHeader':'CustomHeaderValue'],
body : ["body": emlText]
]
asynchttpPost('myCallbackMethod', postParams, [dataitem1: "datavalue1"])

} catch(Exception e) {
  if(e.message.toString() != "OK"){
  	log.error e.message
      }
}

The body does include the emlText I enter in the driver form.

The apprise API also provides for additional parameters that I send via curl like:

curl -X POST -d '{"body":"body test1", "title":"title test"}' -H "Content-type: application/json" http://192.168.10.31:8000/notify/abc123/

I would like to ge able to send the title, i.e. subject line of an email as well. I just don't have any idea how. I'm wondering if the queries option would help, but I've not seen an example of it in use.

Any suggestions, pointers to help would be welcome.

I can at least have Hubitat send an email, text, etc via apprise, just need to make it usable.

thanks
david

One more bit from the curl man page:

-d, --data <data>

(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F, --form.

After using wireshark to sniff packets so I could see what is happening, I am able to get it working.

To include all the -d curl options, you set

body : ["body": emlText, "title":"title test", "tag":"email"]

I can now send email notifications via apprise. Now to make it usable.

The tag value lets you pick which notification system you want to notify, email, twillio, push, emby, kodi, (any of the supported 50 notification services).

david

Final update:

I got it all working. It has been sending notifications to me reliably for a few days now. The Apprise developer added support for a JSON GET command so I can easily get and parse the valid tags.

If anyone else it interested I'll try to figure out github and release something. Warning: I'm an electrical engineer by trade, not a computer scientist. :slight_smile:

david