【问题标题】:Send a push to people who don't subscribe to a channel using Parse?向未使用 Parse 订阅频道的人发送推送?
【发布时间】:2014-02-16 01:59:45
【问题描述】:

我能够向订阅频道的移动客户端发送推送通知(比如说channel_1channel_2,通过将 JSON 发布到https://api.parse.com/1/push 来使用 Parse REST API:

{
    "channels": ["channel_1", "channel2"],
    "data": { "alert": "Test" }
}

但是,我想将通知发送给订阅 channel_1channel_2 但也订阅另一个特定频道 (channel_3) 的人。

有没有办法使用 Parse REST API 做到这一点?我知道我可以通过 Parse 的管理面板做到这一点。

【问题讨论】:

    标签: rest push-notification parse-platform


    【解决方案1】:

    我认为高级定位更适合您想要实现的目标 https://parse.com/docs/push_guide#sending-channels/REST

    查看 Javascript 文档更容易理解这个概念,然后复制到 REST。

    【讨论】:

      【解决方案2】:

      我在 Parse 论坛上发布了我的问题,someone from Parse responded:

      在这种情况下,您需要使用高级定位。基本上,在 Installation 类上构造一个查询,该查询以订阅两个频道的对象为目标,并且“频道”键中没有第三个。

      curl -X POST \
        -H "X-Parse-Application-Id: YOUR_APP_ID" \
        -H "X-Parse-REST-API-Key: YOUR_REST_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
              "where": {
                "channels": {"$all": ["channel_1", "channel_2"], "$nin": ["channel_3"]}
              },
              "data": {
                "alert": "Hello world!"
              }
            }' \
        https://api.parse.com/1/push
      

      【讨论】:

        猜你喜欢
        • 2020-05-21
        • 1970-01-01
        • 1970-01-01
        • 2020-07-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-02
        相关资源
        最近更新 更多