我如何分组pushbullet通知 [英] How can I group pushbullet notifications

查看:128
本文介绍了我如何分组pushbullet通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向我的Android手机发送推送通知。我希望将这些通知分组,以便我的通知列表不会被泛滥。

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.

我从Google Apps脚本调用推送API,并在调用推送API时尝试设置source_device_iden,source_user_iden和notification_tag。

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.

如何将push消息分组到我的手机上?

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

Google Apps脚本代码

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


推荐答案

最简单的方法(承认它应该更容易)是创建一个OAuth客户端,然后使用该oauth客户端的访问令牌发送。这样,推送将全部来自客户而不是你。这是IFTTT和Zapier在Pushbullet上的工作方式。

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.

以下是设置oauth客户端的方法: https://docs.pushbullet.com/#oauth

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

要获得访问令牌,您可以使用oauth测试在创建客户端页面上输入url,一旦您批准访问权限,您将在URL中结束访问令牌。使用该访问令牌而不是普通访问令牌,推送将显示为来自客户端而不是您。

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.

这篇关于我如何分组pushbullet通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆