使用 pushwoosh 通过标签值向设备发送通知
send Notification to device using by tag value using pushwoosh
所以我正在开发一个需要推送通知的应用程序,并且我正在使用 pushwoosh。但目前我一直在研究如何通过标签值向设备发送有针对性的通知。
我正在使用 [http://gomoob.github.io/php-pushwoosh/]
任何帮助将不胜感激。谢谢
$filter = '';
$request = CreateTargetedMessageRequest::create()
->setContent($options['body'])
->setData(
[
'custom' => 'json data'
]
)
->setDevicesFilter($filter);
$pushwoosh->createTargetedMessage($request);
我想要的是过滤器的值
最后我自己解决了。我使用 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);
所以我正在开发一个需要推送通知的应用程序,并且我正在使用 pushwoosh。但目前我一直在研究如何通过标签值向设备发送有针对性的通知。
我正在使用 [http://gomoob.github.io/php-pushwoosh/]
任何帮助将不胜感激。谢谢
$filter = '';
$request = CreateTargetedMessageRequest::create()
->setContent($options['body'])
->setData(
[
'custom' => 'json data'
]
)
->setDevicesFilter($filter);
$pushwoosh->createTargetedMessage($request);
我想要的是过滤器的值
最后我自己解决了。我使用 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);