Skip to content

Instantly share code, notes, and snippets.

@pcon
Last active January 2, 2016 00:39
Show Gist options
  • Save pcon/8225071 to your computer and use it in GitHub Desktop.
Save pcon/8225071 to your computer and use it in GitHub Desktop.
Pushover Electric Imp
//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