Search code examples
google-apps-scriptpushbullet

How can I group pushbullet notifications


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);
}

Solution

  • 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.