使用pushwoosh通过标签值将通知发送到设备

时间:2017-03-12 19:17:18

标签: php pushwoosh

所以我正在开发一个需要推送通知的应用程序,并且我正在使用pushwoosh。但目前我仍然坚持如何通过标签值向设备发送目标通知。
我正在使用[http://gomoob.github.io/php-pushwoosh/]
任何帮助将不胜感激。感谢

$filter = '';
$request = CreateTargetedMessageRequest::create()
->setContent($options['body'])
->setData(
    [
        'custom' => 'json data'
    ]
)
->setDevicesFilter($filter);
$pushwoosh->createTargetedMessage($request);

我想要的是过滤器的值

1 个答案:

答案 0 :(得分:0)

我最终自己解决了这个问题。我使用setCondition()方法为我想要的内容指定标记名称和值。

$request = CreateMessageRequest::create()
    ->addNotification(Notification::create()

        ->setContent($options['body'])
        ->setConditions([
            IntCondition::create('userId')->eq($user_id)
        ]));


// Call the REST Web Service
$response = $pushwoosh->createMessage($request);