#Running custom function when a document is created, deleted or updated

1 messages · Page 1 of 1 (latest)

safe ether
#

is it possible to run custom script when a new document is created? i want to call POST to my cloud server and create folders depending document data

arctic gulch
#

Absolutely! You can wire up a hook on your collection, sounds like you’d want an after change hook (https://payloadcms.com/docs/hooks/collections#afterchange) read more here https://payloadcms.com/docs/hooks/overview

Hooks allow you to add your own logic to Payload, including integrating with third-party APIs, adding auto-generated data, or modifing Payload's base functionality.

You can add hooks to any Collection, several hook types are available including beforeChange, afterRead, afterDelete and more.

safe ether
#

you need to give this hook thing a document