Solution:
Make sure the "then" array inside your If component contains at least one valid UI component. An empty array will trigger the INVALID_PROPERTY_VALUE error.

When working with conditional rendering in a Flow JSON layout, it's easy to overlook the content inside an If component, especially during refactoring or experimentation. But if you define an If block like this:

{
  "type": "If",
  "condition": "${data.val}",
  "then": []
}

You’ll hit the error:

INVALID_PROPERTY_VALUE  

Expected array to contain at least one component.  

This happens because the "then" key must contain a non-empty array of UI components to render when the condition is true. Leaving it empty is considered invalid.

Fix Example:

Update your then block to include at least one valid component. For example:

{
  "type": "If",
  "condition": "${data.val}",
  "then": [
    {
      "type": "Text",
      "text": "Condition met!"
    }
  ]
}

This ensures the Flow has something meaningful to render when data.val is true.

Pro Tips:

  • Don’t leave then: [] empty.

  • Always provide at least one child component inside then.

  • This applies to else too if used.

For more troubleshooting insights related to WhatsApp Business API, check out heltar.com/blogs.