1. Work with webhooks

Create custom events for webhooks

Webhooks are used to capture inputs submitted to your database. You can also set up a workflow that a webhook will trigger when a form is submitted.

Forms sends three types of custom data to the form:engage custom event:

  • VIEWED

  • INTERACTED

  • SUBMITTED

They are created in the following way:

   const event = new CustomEvent("form:engage", {bubbles: true, detail: {name: 'INTERACTED'}} );

To run custom logic when a form is rendered, for example, you can subscribe to the form:engage events. They can be accessed in the following way:

function eventHandler(e) {
  console.log(`The event name is: ${e.detail.name}`);
}
If you have suggestions for improving this article, let us know!