Difference between Equals and Contains conditions

(Vladimir) #1

I wonder what’s the difference between Equals and Contains conditions in Flow XO filters? For example, in case I have a New Message trigger list containing Red Flowers, and an action with {{new_message.message}} Equals Red Flowers filter, I see that it acts on all three messages - Red, Flowers and Red Flowers, the same as with Contains condition. For me it would be more logical if it acts only on Red Flowers message with Equals condition and on Red or Flowers messages with Contains condition.

(Karen Barker) #2

Hi @vlandreev

Equals should have to be a direct match, whereas contains can contain any or all of the message value.

I’ve just tried testing this and I’m not seeing matches when the message is either red or flowers, but only Red Flowers.

If you’re still seeing this working wrongly can you please share your flow with us at support@flowxo.com and we’ll take a closer look. :slight_smile:

(Vladimir) #3

Hi @KarenBarker,
You’re right, but it works different when there are groups defined in New Message trigger:

So, the message Red Flowers grouped as [flowers] is identified only by the first word Red as [colours]. Is it a bug?

(daniel.beckett) #4

Message grouping and filters are separate. What happens is you send the message for “red flowers” and this finds a match on red which is in the group [colours].

If you use your filter to match on the message rather than the group you’ll only match if the message equals what you’re checking for.

(Vladimir) #5

But why it does not look for the complete match - red flowers - with group [flowers]?? It’s like using Contains condition instead of Equals, because a user typing a message does not care whether it’s grouped or not…

(daniel.beckett) #6

Please can you share how your filters are setup? Looking over the images it’s not entirely clear.

(Vladimir) #7

For Red Send a Message action:

For Flowers and Red Flowers Send a Message actions:

(daniel.beckett) #8

When you have a New Message trigger, any received messages will be going through Word & Phrase Matching.

  • If an exact match for the the word or phrase (ignoring case and common punctuation) is found within the message that is sent to the bot, it’s considered a match. For example, if the trigger matches on “cats” and the message is “i like cats”, that is a match. Note that we’re looking for a match on full words, not partial.
  • Otherwise, the word or full phrase is compared against the full message for approximate similarity. For example, if the trigger matches on “i like cats” and the message is “i like a cat”, there’s a match.

To use your example message - the user sends “red flowers” and this matches with ‘red’ which is in the group ‘colours’ and therefore the condition is true.

To avoid this happening you want to make sure trigger words and groups are as unique as possible.

You could also filter on the message rather than the group.

(Vladimir) #9

Yes, but it’s exactly what my initial question was about - the difference between Equals and Contains condition. Following your last explanation, @DanielBeckett, there is no difference and it always works as Contains condition:

Surprisingly it works this way only when groups are defined. When there are no groups, it works as it is supposed to work - different for Equals and Contains conditions, when Red Flowers phrase does not trigger Red action but trigger Red Flowers action, as @KarenBarker has shown before.

Looks like a bug…

(daniel.beckett) #10

The Word & Phrase Matching on the trigger accepts partial matches. It is different from an actual Filter though.

On your filter you are checking that the group is a match, rather than the full message.

With a New Message trigger setup like so:

Red [colours]
Flower [flowers]
Red Flower [flowers]

If you send a message saying Red it will match against the [colours] group. If you send a message saying Red Flowers it will still match against the [colours] group because it triggers the flow with ‘Red’ as the keyword.

If you had a filter on a message to only send if the message equals ‘Red Flowers’ then it would only run if an exact match was found. As the group is being checked instead the condition in your flow is true.

(Vladimir) #11

Hello, @DanielBeckett. Frustratingly I still have troubles filtering actions by group names. Following is a simplified exception from my real flow providing information on different kinds of grapes. There are a New Message trigger and three Send a Message actions working like this:

The actions are equally filtered based on the group names like this:

Till now everything works OK. But if I type single words instead of full phrases, filters surprisingly start to behave differently - while in the first two cases the flow does not start at all, what is expected, the third word triggers the flow by the group name:

Actually I’m struggling to realise why the equal filters behave differently in this case?!??