Created
May 19, 2017 12:58
-
-
Save fujieda/aa4510a4e3b84810cc1cbcb8eefd90fa to your computer and use it in GitHub Desktop.
Push a note to all devices via PushBullet
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
using System.Net; | |
using System.Text; | |
namespace KancolleSniffer | |
{ | |
public class PushBullet | |
{ | |
public static void PushNote(string token, string title, string body) | |
{ | |
using (var wc = new WebClient()) | |
{ | |
wc.Headers[HttpRequestHeader.ContentType] = "application/json"; | |
wc.Credentials = new NetworkCredential(token, ""); | |
wc.Encoding = Encoding.UTF8; | |
wc.UploadString("https://api.pushbullet.com/v2/pushes", | |
$"{{ \"type\": \"note\", \"title\": \"{title}\", \"body\": \"{body}\" }}"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment