Last active
January 2, 2016 00:39
-
-
Save pcon/8225071 to your computer and use it in GitHub Desktop.
Pushover Electric Imp
This file contains 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
//Agent code | |
function send_pushover(title, message, priority) { | |
local url = "https://api.pushover.net/1/messages.json"; | |
local token="XXX_TOKENGOESHERE_XXX"; | |
local user="XXX_USERGOESHERE_XXX"; | |
local headers = { "Content-Type": "application/x-www-form-urlencoded" }; | |
local data = { | |
"token": token, | |
"user": user, | |
"message": message | |
"title": title, | |
"priority": priority | |
} | |
local body = http.urlencode(data); | |
local response = http.post(url, headers, body).sendsync(); | |
} | |
//To use, send_pushover("My title", "My message", 0) | |
//For more on priority see https://pushover.net/api#priority |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment