'Access Pushbullet API from Selenium VBA

I want to send Pushbullet requests from VBA within an Excel macro. In particular, I want to read the latest SMS that I have received and work with the text. In the API description, there is guidance for how to make API requests with CURL, and how to SEND an SMS, but nothing about getting the content of an SMS, and how this can be done with any other tool than CURL. How can it be done with Selenium VBA? So far I have found a post that shows an Outlook macro to push notifications to android devices using PushBullet (https://gist.github.com/jdpilgrim/0248938949b64f8f54ad). While this gives a clue about how Pushbullet API requests can be made with VBA, it does not help GETTING notifications FROM the device. I have these notifications popping up on my PC but have no idea how to access them with VBA. I guess the mentioned VBA code could be modified in some way to achieve this, but without knowing the API requirements to get the body of a message, there is no useful way to try. This is the code, my ideas what might be necessary to change are in the comments:

  Title = Item.Location & " at " & Format(Item.Start, "Short Time") & " " & Format(Item.Start, "Short Date")    
  Body = Item.Subject            '"Body", "Title" would not make sense in a "get message" request

  TargetURL = "https://api.pushbullet.com/v2/pushes"             'maybe "sms" instead of "pushes"?
  Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
  HTTPReq.Option(4) = 13056 '
  HTTPReq.Open "POST", TargetURL, False                           'maybe "GET" instead of "POST"?
  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)
  ' this would get the API response
  Response = HTTPReq.responseText

Even if I get something like this to work, how does one get all the latest messages, so they can be scanned in VBA? I hope someone from Pushbullet reads this and can complete the API documentation. I have not found a way of how to send them the question directly.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source