EasyIoT

Send a Push-Notification by pushsafer.com out of EasyIoT to iOS, Android and Windows 10 devices

Usage in EasyIoT

Simply replace params with yours

Script

public void PushsaferSend(string Title, string Msg, string Icon, string Sound, string Vibration, string Time2Live, string URL, string URLTitle)
{
	System.Collections.Specialized.NameValueCollection queryString = new System.Collections.Specialized.NameValueCollection();
	
	// Replace this params with yours.
	// API description: https://www.pushsafer.com/en/pushapi

	queryString["k"] = "###############";	// Private or Alias Key from Pushsafer.com
	queryString["t"] = Title;		// Your Notification Title
	queryString["m"] = Msg;			// Your Notification Message
	queryString["i"] = Icon;		// Standard = 1 or a number 1-98
	queryString["s"] = Sound;		// empty=device default, 0=silent or a number 1-28
	queryString["v"] = Vibration;		// empty=device default or a number 1-3 (only iOS, Android)
	queryString["l"] = Time2Live;		// Integer number 0-43200: Time in minutes, after which message automatically gets purged.
	queryString["u"] = URL;			// optional URL or URL scheme
	queryString["ut"] = URLTitle;		// optional Title of URL, if empty the url is displayed

	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://www.pushsafer.com/api", queryString);
		}

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

How to use the code in an EasyIoT Automation Program

PushsaferSend("EasyIoT Title", "Test Message from EasyIoT!", "1", "12", "3", "", "https://www.pushsafer.com", "Open Pushsafer");

For more information about replacing values (title, message, icon, icon color, sound, vibration) in your push notification, check out our API description!


© 2016 - 2024 Pushsafer.com, All rights reserved.