Dialogflow Messenger df-response-received event

I got this question on my YouTube channel recently:

Hi, thanks for sharing this video! i have a question: – how i use Events JavaScript from dialogflow messenger (df-request-sent & df-response-received)

I used the df-response-received event as part of my Dialogflow CX bot which helps you choose between ES, CX and Actions Builder.

Here is some sample code:

Suppose the dfMessenger object has been added to your HTML like this (just copy this from the Dialogflow console)

<script src="https://www.gstatic.com/dialogflow-console/fast/messenger-cx/bootstrap.js?v=1"></script>
<df-messenger df-cx="true" chat-title="DFChooser" agent-id="your-agent-id-goes-here" language-code="en"></df-messenger>Code language: HTML, XML (xml)