Route Setup to Pushbullet.com


#1

Is it possible to create a route to the Pushbullet.com service. I have tried creating a custom webhook using my limited experience to no avail.
I was successful in sending a Post via wifi on an arduino platform directly to Pushbullet but have not been successful using Routes and a Dash. Trying to get away from WiFi and go cellular for obvious reasons.
Any help appreciated !!


#2

How you setup the route depends on what you are trying to send. For Dash to my server’s route I created a topic and its route sends the data as a variable in the URL request:

http://myserv.er/script.php?data=<<decdata>>

Where “decdata” is the decoded data from my Dash. In this case I create colon separated data of “temp:volts:count” and a topic of “T”

  HologramCloud.print(sensors.getTempFByIndex(0));
  HologramCloud.print(":");
  HologramCloud.print(Charger.batteryMillivolts());
  HologramCloud.print(":");
  HologramCloud.print(cnt);
  HologramCloud.attachTag("T");
  HologramCloud.sendMessage();

Pushbullet’s API looks to be JSON based, so you’d use https://api.pushbullet.com for destination and then either compose JSON in the Post using variables or use ‘decdata’ if your Dash is already sending the properly formatted JSON.

This page has a pretty good breakdown with examples: https://hologram.io/docs/guide/cloud/data-router/

I haven’t used it before, but you’ll probably need to set up an authorization header in the route and include your access token for pushbullet.


#3

Thanks Jer
Tried your suggestions and still having Route errors. Tried all different combinations to no avail. Below is a section of the code that I used which works when communicating through my wifi setup. Can you provide suggestions how to configure a route based on this code? Thanks in advance.

const char* host = “api.pushbullet.com”;
const int httpsPort = 443;
const char* PushBulletAPIKEY = “my authorization key”;
// Use web browser to view and copy SHA1 fingerprint of the certificate from //https://www.grc.com/fingerprints.htm
const char* fingerprint = “E7 06 F1 30 B1 5F 25 72 00 4D 99 F0 ED 90 4D F9 60 D3 FB 75”;

           Serial.println("\nStarting connection to server...");
	// if you get a connection, report back via serial:
	if (client.connect(host,httpsPort)){
 	Serial.println("connected to server");
 	// Make a HTTP request:
 	if (client.connected())
	{Serial.println("certificate matches");} 
	else 
	{Serial.println("certificate doesn't match");}
 	String url = "/v2/pushes";
 	String messagebody = "{\"type\": \"note\", \"title\": \"Push Title\", \"body\": \"Closing Verbage\"}\r\n";
 	Serial.print("requesting URL: ");
 	Serial.println(url);
 	client.print(String("POST ") + url + " HTTP/1.1\r\n" +
 	"Host: " + host + "\r\n" +
 	"Authorization: Bearer " + PushBulletAPIKEY + "\r\n" +
 	"Content-Type: application/json\r\n" +
 	"Content-Length: " +
 	String(messagebody.length()) + "\r\n\r\n");
 	client.print(messagebody);
 	Serial.println("request sent");

#4

Sorry, I don’t have direct experience with PushBullet, but I should give it a try, so I can get notified when my dash battery is low. ":^)

Are you sending just JSON as your Hologram message (i.e. something like the messagebody above)?

So destination URL:

 https://api.pushbullet.com/v2/pushes

Then in the route’s Payload (the decoded JSON):

<<decdata>>

Then down below the headers section add one for your authorization, not sure if you’d need to have the content-type/length.

Sending JSON from dash might look something like:


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.