How to proceed to the next step automatically

If you would like your flow to automatically proceed to the next step after a specific action, you can do that with a little bit of coding. 

In the example below, we are simulating the use case where, after successfully booking a meeting, the visitor automatically proceeds to the next step (the embed code of the Hubspot booking is not included here). 

The first part of the code listens to the event of a successful booking, then, the second part simulates a button click on an invisible submit button - making the flow to proceed to the next step. 

<script>
var form = document.querySelector('.UP_formContainer');
var button = document.createElement('button');
button.setAttribute('type', 'submit');
button.style.display = 'none';
form.appendChild(button);

window.addEventListener('message', (event) => {
  const e = event.origin === 'https://meetings.hubspot.com'
 & event.data.meetingBookSucceeded;
  if (e) {
 button.click();
  }
});
</script>