You can use webhooks to add custom business logic in both Dialogflow ES and Dialogflow CX. You need to write some code running on a remote server to build webhooks, and the data sent to your webhook will be in a pre-specified format, and you need to ensure that the data returned from your webhook is also in a pre-specified format.

This is what a webhook definition looks like in Dialogflow ES:

It is important to note that one of the reasons CX is considered to be much better than ES is that you can develop a lot of this custom business logic within the CX user interface itself instead of relying on a developer.

In addition, in CX webhook endpoints (the URL where the data is sent) can be defined per intent, while in ES you will define a single endpoint for the entire agent.