Do wix data hooks not run when an insert is run in a backend .jsw file?

Came across something unique which I wanted to ask the forum.

Ran a insert function ( in a backend jsw module

Added an after insert hook to send the data to a webhook.

Wasn’t working for the longest time. Added the insert function in the frontend and it the insert hook fired away.

Am I doing something wrong?

Its difficult to say without seeing your code, but the hook should run per the documentation at these times:

  • The insert() function is called.

  • An action is performed on a dataset that inserts a new item into the collection.

  • An item is inserted using the Content Manager.

  • An item is imported into the Sandbox or Live collection.

Is your hook code located in data.js?
When you say wasn’t working, what do you mean? Was there an error? Did you have any logs in there to check?
How are you testing your code? (live, preview, functional testing)