Notifications via Pushover service & Keyboard Maestro


#1

I’ve posted a plug-in action that allows you to send notifications to the Pushover service. Notifications can be sent to iOS, Android or desktop computers.

I’ve posted the plug-in, along with instructions on my git hub page:
Pushover Plug-in on GitHub

The Pushover service is free and you’ll need to create an application API key to use the Pushover plug-in. Pushover allows 7,500 notifications/month per user for free so unless you’re sending a lot of notifications it should remain free for you.


#2

Thanks @kvanh! This plugin works great. One request (for an update). Now that pushover supports optional URL (and url_title) could you include those as well?


#3

I’ve now tested this Plug-In with Keyboard Maestro 8 and all seems to be working.
Also @johns I’ve added URL and URL Title options to the module.

GitHub has all the changes:
Keyboard Maestro Pushover Notifications Plug-In

Note: If you overwrite your existing PushoverNotification.scpt file with the new one on GitHub, you’ll need to re-enter your API information in the file.


#4

:thumbsup:


#5

FYI @kvanh – I’m getting an error running the script

~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/Pushover Notifications/PushoverNotification.scpt: execution error: Can’t get text 1 thru 14 of "Test title". (-1728)

When invoking the following action

Send a notification via Pushover
Priority: Normal
Title: Notification Title
Notification Message:
HTML formatted notification message. Go here <a href=‘http://test.com'>Here</a>
URL Title:
Test title
URL:
http://google.com
Notification Sound: User Default
Display trimmed results in a window.

#6

I submitted a pull request on github, but until/unless it is merged you can find the fix here:

The optional values would fail if their length was less than the default values.


#7

Pull request accepted. Thanks. There’s got to be a simpler way to compare strings in AppleScript that I’m missing.


#8

You know, I didn’t even think about that, I just blindly got rid of the error.

I believe you can do if UrlTitle is "Optional title"?
If not that then (UrlTitle as string) is "Optional title" should work.

Sorry, no time to test right this minute.


#9

Hi @kvanh, thanks a lot for this great plugin!

Works really well, even in KM 6. I was wondering: In January Pushover introduced the pushing of images, see here.

Is there any chance to have this feature included in the plugin? Would be great if you could attach an image file.

Thanks again!


#10

Ok, I added a file attachment feature now (and did some fixes to the alter sound settings) and made a pull request on GitHub. @kvanh Maybe you want to merge it?

For others, the plugin including the file attachment feature can be downloaded here.


#11

Hi all,

I discovered this really nice plugin. I downloaded and tested the two different versions (the one from @kvanh and the one from @trych with the file attachment option).

They both work perfectly except the message encoding.

I sent the following message:

« Un barbu, c’est un barbu. Mais deux barbus, c’est des barbouzes! » Kinda blurry but I love this pic! So good to have seen you again Nico! #floggingmolly #anciennebelgique #friendship :beer:

And this is what I received on my iPhone:

« Un barbu, c’est un barbu. Mais deux barbus, c’est des barbouzes! » Kinda blurry but I love this pic! So good to have seen you again Nico! #floggingmolly #anciennebelgique #friendship 🍺

I pasted and sent the exact same text through the Pushover website. The message was correctly received on the iPhone.

I really appreciate any help you can provide.


#12

It might be because the TextBody of the KM plugin has to be written with HTML. But I'm not quite sure. I'm not so fit in such things @carycrusiau

With me it works like this:

CloudApp


#13

You can save the text into a variable first and then filter the variable with "Encode HTML Entities". That takes care of the special characters. Then you can insert that variable in the Pushover Macro.

However, this does not seem to work for the emoji character. I don't know how to handle this one. The string :beer: stays :beer: currently.

@peternlewis Should the Encode HTML Entities filter not also take care of emoji strings like :beer: and then encode them to their HTML entity &#127866;? Or am I misunderstanding the functionality or is there another way? Thanks!


#14

Encode HTML Entities encodes the characters as listed at http://www.w3.org/TR/REC-html40/sgml/entities.html

:beer: are not entities. I'm not sure what they are. They are supported by Discourse (Markup), and apparently by Slack (so I heard the other day), and presumably elsewhere. But they are not HTML Entities.

If there is a good specification with a list somewhere, and if they map to emoji characters, then I can probably offer a filter to encode/decode them.

I found this site https://www.webfx.com/tools/emoji-cheat-sheet/ and indeed, if I use them in Discourse, they are images, not characters, so that will not work with a filter.


#15

Hm, when I paste an emoji directly into a KM variable, then KM maintains the emoji itself, even after the HTML filter. Would be great if there would be an option to convert these emojis to their corresponding HTML code as well.

I found a json file with emojis and their HTML code here. Maybe this could help?

Or is there any way to create an own replacement macro with help of such a Json file?


#16

Thanks to everybody! It works very well now!


#17

Hi @carycrusiau, @trych & @peternlewis,

thanks to the post of the HTML codes, I remembered a pick list here from the forum and used it for this purpose.
The red field shows the coordinates of my cursor (iMac). You'd have to change them.

11)HTML Emoji.kmmacros (16,6 KB)

11)HTML%20Emoji

CloudApp


#18

Basically I guess that would simply mean encoding all the non-ASCII into unicode decimal (&#12345;) codes. I could add an option for this I suppose, but it's not very interesting, in that:

  • There is no information actually required, it is just converting character to decimals
  • There really should be no necessity for this any more, files should all be in UTF8 and served as UTF8, and then they can just contain the characters.

I’ll ponder whether it is worth doing as an additional filter.