2

I am sending push notifications to my Android phone. I want these notifications grouped so my notification list does not get flooded.

According to the documentation messages from the same 'source' get grouped but on my phone the messages always show up ungrouped.

I call the push API from a Google Apps script and have tried setting source_device_iden, source_user_iden and notification_tag when I call the push API. None of these seem to make any difference.

How can I get the pushmessages to be grouped on my phone?

Google Apps script code

function pushNoteToPhone(title, body) {
   var digest = "Basic "+Utilities.base64Encode(PUSH_BULLET_TOKEN+":");
   var options = {
    "method" : "post", 
    "payload" : {
      "device_iden" : MYPHONE_ID,
      "type" : "note",
      "title" : title,
      "body" : body,
      "source_device_iden" : <device id>,
      "notification_tag": "tag1",
    }, 
    "headers" : {
      "Authorization": digest
    }
  };

  var push_bullet_url = "https://api.pushbullet.com/v2/pushes";
  UrlFetchApp.fetch(push_bullet_url, options);
}
Rene
  • 85
  • 1
  • 6

2 Answers2

1

The easiest way to do this (admittedly it should be easier) is to create an OAuth Client and then send using an access token for that oauth client. That way the pushes will all appear to come from that client instead of you. This is how IFTTT and Zapier work on Pushbullet.

Here's how to setup an oauth client: https://docs.pushbullet.com/#oauth

To get an access token you can use the "oauth test url" on the create client page, you will end up with an access token in the URL once you approve access. Use that access token instead of your normal one and the pushes will appear to come from the client instead of you.

Chris Pushbullet
  • 1,039
  • 9
  • 10
  • How would this make a difference? I then change the source client. Why would the message from this new client be grouped while this is not done for my current client? – Rene May 17 '15 at 19:42
  • As far as I can tell you are currently using no client at all, i.e. the "default pushbullet client". Those are not grouped because it would for almost all users be the same as the "all pushes" group. Using an oauth client causes pushes to be grouped. I believe 'source_device_iden' is not used for grouping. – Chris Pushbullet May 18 '15 at 17:09
  • You could be right. It would be nice to know upfront but pushbullet employees do not seem to be very active on any channel. I will give it a try to see if this is indeed the case. – Rene May 20 '15 at 06:58
  • I am one of the co-founders of Pushbullet. – Chris Pushbullet May 20 '15 at 17:14
  • It turned out it was easy to created the OAuth client. Your documentation is very clear on that part. And it works great. Thanks. – Rene May 21 '15 at 19:39
  • Awesome, sorry for the confusion with how to group messages though, that should be made more clear, it's sort of a side effect of the oauth stuff. – Chris Pushbullet May 22 '15 at 02:49
0

Don't know how you are trying to update the notification but without the code, my guess is that you are trying to pass a new Notification ID to each notification being sent to the device. However, please take a look here and look under, "Updating Notifications". As explained in the documentation, by passing the same ID to each notification it will either group these notifications on the device or create a new one in case the old one has been dismissed.

pointNclick
  • 1,584
  • 1
  • 12
  • 17
  • I have added the code I use. You are refering to Android code. I do not have an Android app. That app is the pushbullet app. The question is about how the existing pushbullet app handles the push message sent through the pushbullet API. – Rene May 06 '15 at 07:29