Trouble filtering new order events with FeedV3 expression

I’m building a dashboard integration that should listen to three types of Feed events:

  • New order
  • Canceled order
  • Invoiced order

Additionally, the orders should only be from:

  • salesChannel 1
  • salesChannel 2

I was previously using the Feed integration with FromWorkflows instead of FromOrders configuration. However, since now I need to filter salesChannels in addition to statuses, I had to move to the FromOrders method.

The problem: while using FromWorkflows I was able to filter new orders through the order-created status. Now, using FromOrders, no events with that status seem to show on the Feed.

This is my current Feed configuration:

{
    "filter": {
        "expression": "(((status = \"order-created\") or (status = \"invoiced\") or (status = \"canceled\")) and ((salesChannel = \"1\") or (salesChannel = \"2\")))",
        "disableSingleFire": false,
        "type": "FromOrders"
    },
    "queue": {
        "visibilityTimeoutInSeconds": 240,
        "messageRetentionPeriodInSeconds": 604800
    },
    "quantity": 16,
    "approximateAgeOfOldestMessageInSeconds": 2147483647.0
}

Is there something wrong with it?
How should I change the expression in order to achieve the desired outcome?

1 Like

Hi Breno!

Reviewing the structure of the expression, I don’t see any errors. However, I could recommend using the “on-order-completed” state, since you will obtain the information on complete orders, and in this way prevent incomplete orders from generating unnecessary events.

Here is an example of an expression that generates the event of a new order:

"filter": {
        "expression": "(status = \"on-order-completed\" or status = \"invoiced\" or status = \"canceled\") and (salesChannel = \"1\" or salesChannel = \"2\")",
        "disableSingleFire": false,
        "type": "FromOrders"
},

Please, let me know if using this state the events are reflected in the Feed.

2 Likes

Thanks for your answer, Carlos! I’ll try it right away.

1 Like