Skip to content

Instantly share code, notes, and snippets.

@jdpilgrim
Created March 27, 2015 16:35
Show Gist options
  • Save jdpilgrim/0248938949b64f8f54ad to your computer and use it in GitHub Desktop.
Save jdpilgrim/0248938949b64f8f54ad to your computer and use it in GitHub Desktop.
Outlook macro to push notifications to android devices using PushBullet
'You need to paste it into the code file called "ThisOutlookSession".
'IMPORTANT You'll need to change the text YOUR_ACCESS_TOKEN to your Access Token that you
'you got from https://www.pushbullet.com/account
Const vbDoubleQuote As String = """" 'represents 1 double quote (")
Const vbSingleQuote As String = "'" 'represents 1 single quote (')
Private Sub Application_Reminder(ByVal Item As Object)
Dim Title As String
Dim Body As String
Dim Message As String
If Item.MessageClass <> "IPM.Appointment" Then
Exit Sub
End If
Title = Item.Location & " at " & Format(Item.Start, "Short Time") & " " & Format(Item.Start, "Short Date")
Body = Item.Subject
TargetURL = "https://api.pushbullet.com/v2/pushes"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Option(4) = 13056 '
HTTPReq.Open "POST", TargetURL, False
HTTPReq.SetCredentials "user", "password", 0
HTTPReq.setRequestHeader "Authorization", "Bearer YOUR_ACCESS_TOKEN"
HTTPReq.setRequestHeader "Content-Type", "application/json"
Message = "{""type"": ""note"", ""title"": " & _
vbDoubleQuote & Title & vbDoubleQuote & ", ""body"": " & _
vbDoubleQuote & Body & vbDoubleQuote & "}"
HTTPReq.Send (Message)
' delete this line once you are happy it works. Or put in some proper error handling!
MsgBox (HTTPReq.responseText)
End Sub
@VincentMoya77
Copy link

Looking at this script, I've modified it by changing title to be Item.Sender, but I would like to see how to integrate Body to be Item.Subject AND Item.Body of a MS exchange email. Been trying everything I can think of, and unfortunately not good with VB Scripting. End result is that I would like to send a pushbullet note, containing message sender, subject and message body.

Any help would be appreciated.

Thanks

Copy link

ghost commented Jan 25, 2018

How do I enable this code to run? Can I apply this script to RULES?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment