g

Forms Autoresponder

Hooks allows us to create custom email notifications that are sent to the customer upon form submission. In this example we will create a hook that will send a email to the customer that includes a PDF guide for them to download. 


Navigate to Automations > Hooks > List and add a new hook to the existing list:



Add Name & Description to the new hook, this will also display on the Hooks list page

  1. Configure the “Entity Event Triggers”:

    1. Entity: Form Submission

    2. Method: Completed


  1. Save the Hook


Upon save you will be reriderced to the “Actions” page in the admin where conditions and actions can be configured. Actions can also be accessed via the List page.


For this example we need to configure the following:

The final setup will look like below:



Condition is configured first, and the action is configured within the condition. 


Add Condition


  1. Add description to the condition, this will also be displayed in the action area in the admin as per the previous screenshot

  2. Choose Condition Type = Template and add the following:

{* Only execute for eBook download (id 7) *}

{$result->setMatching($event->getRecord()->form->id == 7)}

The above code snippet ensures the email notification is only send to customers that complete the form that has id = 7. 


Form ID can be retrieved from the Forms module. Hover over the ‘edit’ pencil and check the link at the bottom of the page:


  1. Click Save to save the condition


Add Action

Now navigate back to the actions and add a new action under the created condition. Actions can be accessed via the Hooks > List page:



  1. Add a new action by clicking on the “Add Action” link under the created condition


  1. Choose “Send Mail” action


  1. Configure the action:

    1. Add description

    2. Unique Identifier

    3. Set “From Email Address”

    4. Set “From Name”

    5. Set “To Email Address”

    6. Set “To Name”

    7. Set “Subject”

    8. Set “Template file” from your BitBucket Repository or use the below “Template code” area


In order to send the email directly to the customer who submitted the email, update the “To Email Address” & “To Name” to pull the information about the customer from the submitted form:


Get customer Email

{$event->getRecord()->data.email}


Get customers First Name & Last Name

{$event->getRecord()->data.firstname} {$event->getRecord()->data.lastname}


The last step is to add the email notification HTML & CSS code in the Template Code area. This will determine the structure & style of the sent email. 


Please find an eBook HTML template that can be used as a starting point:

https://drive.google.com/file/d/1bzaOkOx3L9-XRbnI1gy9HlYLlXpIc6F7/view?usp=sharing



Last step is to enable the Hook in the main Hooks > List area:



All form submissions can be viewed in the Interactions > Forms > Submissions area in the admin, while all sent emails can be viewed in the Interactions > Mailer > Emails area in the admin.