kpcyrd/notify-pushover
function run(arg)
local user_key = getopt('user_key')
if not user_key then return '-o user_key= missing' end
local api_token = getopt('api_token')
if not api_token then return '-o api_token= missing' end
local text = arg['subject']
if arg['body'] then
text = '**' .. text .. '**\n\n' .. arg['body']
end
local session = http_mksession()
local req = http_request(session, 'POST', 'https://api.pushover.net/1/messages.json', {
form={
token=api_token,
user=user_key,
message=text,
}
})
local r = http_fetch_json(req)
debug(r)
end