繁体   English   中英

使用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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM