Welcome, Guest
Username: Password: Remember me

TOPIC: Send Push Notifications Over PushOver

Send Push Notifications Over PushOver 1 year 6 months ago #2502

  • lennysh
  • lennysh's Avatar
  • Offline
  • New Member
  • Eat. Sleep. Drink. IT.
  • Posts: 7
  • Karma: 0
Just figured I'd share the code I'm using to send notifications using PushOver from the EasyIoT Server...

(If you prefer to use PushBullet instead, I posted that code on this topic...)

Enjoy!
public void PushOverSend(string Title, string Msg)
{
	System.Collections.Specialized.NameValueCollection queryString = new System.Collections.Specialized.NameValueCollection();
	queryString["token"] = "Application API Token/Key";
	queryString["user"] = "Your User Key";
	queryString["title"] = Title;
	queryString["message"] = Msg;

	try {
      	System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
		using (System.Net.WebClient client = new System.Net.WebClient()) {
			client.UploadValues("https://api.pushover.net/1/messages.json", queryString);
		}

	} catch (Exception ex) {
		Console.WriteLine(ex.Message);
	}
}

And here is how to use the code in an Automation Program...
PushOverSend("EasyIoT Message", "Test Message from my PushOver Code!");
Last Edit: 1 year 6 months ago by lennysh. Reason: Cleaned up the code a bit...
The administrator has disabled public write access.
Time to create page: 0.171 seconds
Powered by Kunena Forum