Here is my conditions array in my request to pushwoosh:

Right now it only sends the message when all conditions are satisfied. What if I want to make it one or the other?

Like this:

Site ID = 10 AND ( Businesses IN [2] OR Subscriptions IN ['contests'])

--- here is that segment of the request:

[conditions] => Array (
    [0] => Array
            [0] => Site ID
            [1] => IN
            [2] => Array
                    [0] => 10


    [1] => Array
            [0] => Subscriptions
            [1] => IN
            [2] => Array
                    [0] => contests


    [2] => Array
            [0] => Businesses
            [1] => IN
            [2] => Array
                    [0] => 2


asked 02 Aug '16, 19:07
javacado's gravatar image


What I did was create a value "none" for tags where users didn't set a value for it. So "none" means "nothing selected" because Pushwoosh doesn't accept a null or empty string when creating conditions.

"conditions": [["siteId", "IN", ["10"]], ["business", "IN", ["2","none"]], ["subscriptions", "IN", ["contests","none"]]]

It will send a push if any of these conditions are true:

siteID=10 and business=2
siteID=10 and subscriptions=contests
siteID=10 and business=2 and subscriptions=contests
siteId=10 and business=none and subscriptions=none

This is almost what you need except for the last scenario.

If you can spare using another tag there is a workaround but it will require a little bit of logic in your app when setting the value of the tag. Create a new tag that in an ideal world we'd called "business_and_subscription_is_none", but we'll have to settle for "bizsubnone". In your app if both business and subscription settings are empty (or none) then set the tag bizsubnone to 1. It's a bit flag so the default value would be 0 meaning either subscription or business has a value. Then use this condition logic:

"conditions": [["siteId", "IN", ["10"]], ["business", "IN", ["2","none"]], ["subscriptions", "IN", ["contests","none"]], ["bizsubnone", "IN", ["0"]]]

This is the answer to your question although I don't know how it will impact any other conditions you might want to include. But I hope you get the idea and can expand on it.

permanent link
answered 03 Aug '16, 02:15
Gary_oo's gravatar image


edited 03 Aug '16, 02:17

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 02 Aug '16, 19:07

question was seen: 556 times

last updated: 03 Aug '16, 02:17