Will wix velo labelContacts() trigger automations using "entered segment"

I’ve got an automation whose trigger is “when enters segment”. The segment is defined as contacts with a particulate label. If I manually add the label in the dashboard then the automation runs. When I add the label to the contact from backed code it does not run. Bug? Be design? Workaround?

Can you share the code that’s not working?