title: OneSignal php target tags
body: <p>I am trying to send a push notification to users with specific tags using the api for the OneSignal service found here: <a href="https://www.onesignal.com/" rel="nofollow">https://www.onesignal.com/</a> </p>
  
  <p>I can't seem to format the array correctly. Here is what I have or want but it's not working: </p>
  
  <pre><code>"tags" =&gt; array[{"key": "NotifyLive", "relation": "=", "value": "true"}],
  </code></pre>
  
  <p>So I want to target users who have a Tag of "NotifyLive" set to "true".</p>
  
  <p>I believe this can be done because it shows it in the <a href="https://documentation.onesignal.com/docs/notifications-create-notification" rel="nofollow">documentation here</a>. Scroll down to the <strong>tags:array of objects</strong> examples.  I just can't figure out how to code that one line.</p>
  
  <p>Here are the fields I am sending with my notification:</p>
  
  <pre><code>$fields = array(
        "app_id" =&gt; "example",
        "android_sound" =&gt; "$num",
        "big_picture" =&gt; "http://website.com/mypic.jpg",
        "tags" =&gt; array[{"key": "NotifyLive", "relation": "=", "value": "true"}],// Doesn't work! 
        "data" =&gt; array("autoplay" =&gt; "true"),
        "contents" =&gt; $content,
        "headings" =&gt; $heading
      );
  </code></pre>
  
  <p><strong>ERRORS:</strong>
  JSON received: {"allresponses":"{\"errors\":[\"Tags must be an array. For example, [{\\"key\\": \\"gender\\", \\"relation\\": \\"=\\", \\"value\\":\\"male\\"}]\"]}"}</p>
  
  <p>The team has AMAZING support but I need an answer outside of business hours as I am coding now. Thanks for any insights.</p>