I’m trying to use this code to capture user choice in the chatbot
window.HubSpotConversations.on('quickReplyButtonClick', event => {
console.log(`The text content of the clicked button is ${payload.value[0]}`);
});
that I found on this page
So I wrote
window.hsConversationsSettings = {};
if (window.HubSpotConversations) {
onConversationsAPIReady();
} else {
window.hsConversationsOnReady = [onConversationsAPIReady];
}
function onConversationsAPIReady() {
console.log(`HubSpot Conversations API:: ${window.HubSpotConversations}`);
window.HubSpotConversations.on('quickReplyButtonClick', event => {
console.log(`The text content of the clicked button is ${payload.value[0]}`);
});
window.HubSpotConversations.on('conversationStarted', payload => {
console.log("ok");
console.log(payload);
});
}
The console.log(“ok”) event runs.
The console.log(`The text content of the… event is not executed.
What am I doing wrong?
Thank you