PushbulletSharp

A few months ago I found a new service called Pushbullet. Pushbullet is a simple and easy to use service that allows you to not only push alerts to devices but push files. I originally found this while I was searching for easy to implement ‘push’ solutions. I needed something to alert me when something goes wrong in one of the applications I regularly work on. Emails are great; push alerts are better.

Pushbullet offers a great HTTP API which can get you up and running for the platform of your choice. I decided to write my own client for their API in C#. And what ended up happening is I created a package that others could easily use. I decided to make this open source and share it with anyone interested. You can view the project on GitHub, and please fork it if you have fixes or updates you think would make the library better.

The funny thing about all of this is that I had written 90% of PushbulletSharp months ago and even posted it on GitHub. I implemented most of the push operations. The one operation I did not implement fully was the push file feature. I had kind of started working on it but never finished it. And it quickly became one of those “I’ll get back to it someday” functions. All of this changed one morning before work when I got an email from a user on GitHub about a new issue.

When preview the URL in browser, HTTP error 403 is displayed.

Everything looks OK when stepping through.

The code I written on VB:

Private Sub PushFile()
Dim Client As New PushbulletClient(ApiKey)
Dim request As New PushFileRequest() With { _
.device_iden = “xxxxxxxxxxx”, _
.file_type = “image/png”, _
.file_name = “image.png”, _
.file_path = Application.StartupPath & “\” & “image.png”
}
Dim response = Client.PushFile(request)
MsgBox(“pushed”)
End Sub

Am I misssing anything?

I felt like such a jerk. I originally just put the code up there for backup purposes. That and so I could easily get the source from various machines at home.

I responded immediately by saying that I’d try to work on it that weekend. I ended up fixing the issue and completing my Pushbullet wrapper. From there I decided to see if I could make my own NuGet package for other developers to use from Visual Studio. It ended up being pretty simple with some searching and I plan to do a write up on how I packaged up PushbulletSharp in another blog post.

Anyone wanting a simple .NET Pushbullet client can start using PushbulletSharp today via NuGet. The easiest way to add it to your current project is to right click on your project in Visual Studio and choose “Manage NuGet packages…”, and under the online section, search for “Pushbullet” or “PushbulletSharp”.

Once you’ve added it to your project you can get started quick as long as you have your API key. I’ve already leveraged GitHub’s wiki feature to document as much as I can about the library by creating a PushbulletSharp Wiki. I’ve documented everything from push request objects, to response objects, to simple push examples.

Leave a Comment