OneSignal php目标标签

I am trying to send a push notification to users with specific tags using the api for the OneSignal service found here: https://www.onesignal.com/

I can't seem to format the array correctly. Here is what I have or want but it's not working:

"tags" => array[{"key": "NotifyLive", "relation": "=", "value": "true"}],

So I want to target users who have a Tag of "NotifyLive" set to "true".

I believe this can be done because it shows it in the documentation here. Scroll down to the tags:array of objects examples. I just can't figure out how to code that one line.

Here are the fields I am sending with my notification:

$fields = array(
      "app_id" => "example",
      "android_sound" => "$num",
      "big_picture" => "http://website.com/mypic.jpg",
      "tags" => array[{"key": "NotifyLive", "relation": "=", "value": "true"}],// Doesn't work! 
      "data" => array("autoplay" => "true"),
      "contents" => $content,
      "headings" => $heading
    );

ERRORS: JSON received: {"allresponses":"{\"errors\":[\"Tags must be an array. For example, [{\\"key\\": \\"gender\\", \\"relation\\": \\"=\\", \\"value\\":\\"male\\"}]\"]}"}

The team has AMAZING support but I need an answer outside of business hours as I am coding now. Thanks for any insights.

Figured out the answer. The array had to be written in this format:

 // This Array format worked
 $daTags = array(
      array("key" => "NotifySound", "relation" => "=", "value" => "true"),
      );

    $fields = array(
      "app_id" => "exampleID",
      "android_sound" => "$num",
      "big_picture" => "http://wesite.com/mypic.jpg",
      "tags" => $daTags,
      "data" => array("autoplay" => "true"),
      "contents" => $content,
      "headings" => $heading
    );

As the tags field is being deprecated, you should use the filters field to target users by tags

$filters = array(
    array("field" => "tag", "key" => "NotifySound", "relation" => "=", "value" => "true"),
);

$fields = array(
  "app_id" => "exampleID",
  "android_sound" => "sound",
  "big_picture" => "http://wesite.com/mypic.jpg",
  "filters" => $filters,
  "data" => array("autoplay" => "true"),
  "contents" => $content,
  "headings" => $heading
);