I want to add a trigger to my neo4j so that when a new file is added, it will either execute a custom python code, or at the very least make an api call sending the information on the node created Not sure how I should do this:
Something following this logic:
CALL apoc.trigger.install('neo4j', 'on create trigger',"UNWIND $createdNodes AS n
custom_function(n))
You could use try using apoc.load.jsonParams
to make the API call from inside the trigger.
Assuming your endpoint was foo.bar/baz
it would look something like this (sending a list of nodes created):
CALL apoc.trigger.install(
'neo4j',
'MyTrigger',
"CALL apoc.load.jsonParams('https://foo.bar/baz', {method: 'POST'}, apoc.convert.toJson({'nodes': $createdNodes})) ",
{phase: 'afterSync'})