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.