Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #3625821
WordPress hooks
Closed

Comments

  • Olaf started the conversation

    Hi,
    I would like to use one of your WP hooks for a newsletter subscription.

    To do this I will create a custom field (checkbox) and whenever this field is checked a subscription to our email marketing system (EmailOctopus) need to be processed. Which of the hooks is the best I can use for this job? 

    I would say I need to use the action hook "amelia_after_appointment_added" but the information says "Users can use this hook to do an action after an appointment is added from the backend.

    If an appointment is not added (for some reason) the subscription will not be processed. Maybe it's better to use "amelia_before_appointment_added" instead?

    A second question is, is all the submitted form data available inside the function argument $appointment?

    Thanks and kind regards

    Olaf

  •  1,177
    Uroš replied

    Hello Olaf,

    Amelia currently has the following hooks:

    <script>
      window.ameliaActions = {
        ViewContent: function (success = null, error = null, data) {
          //triggered when the form loads
          console.log('ViewContent HOOK');
          console.log(data);
          console.log('------------');
        },
        SelectService: function (success = null, error = null, data) {
          //triggered when the service is selected/changed in the form
          console.log('SelectService HOOK');
          console.log(data);
          console.log('------------');
        },
        SelectEmployee: function (success = null, error = null, data) {
          //triggered when the employee is selected/changed in the form
          console.log('SelectEmployee HOOK');
          console.log(data);
          console.log('------------');
        },
        SelectLocation: function (success = null, error = null, data) {
          //triggered when the location is selected/changed in the form
          console.log('SelectLocation HOOK');
          console.log(data);
          console.log('------------');
        },
        SelectCategory: function (success = null, error = null, data) {
          //triggered when the category is selected/changed in the form
          console.log('SelectCategory HOOK');
          console.log(data);
          console.log('------------');
        },
        SelectPackage: function (success = null, error = null, data) {
          //triggered when the package is selected/changed in the form
          console.log('SelectPackage HOOK');
          console.log(data);
          console.log('------------');
        },
        customValidation: function (success = null, error = null, data) {
          console.log('customValidation HOOK');
          console.log('------------');
          console.log(data);
          const customValidator = (rule, value, callback) => {
            if (value.includes('SOME_REGEX')) {
              callback(new Error());
            } else {
              callback();
            }
          };
          // this example is for email input field
          data.rules.email.push({ message: 'CUSTOM MESSAGE', validator: customValidator });
        },
        InitiateCheckout: function (success = null, error = null, data) {
          //triggered once the customer lands on the "info" page where they fill in their details
          console.log('InitiateCheckout HOOK');
          console.log(data);
          console.log('------------');
        },
        Schedule: function (success = null, error = null, data) {
          //triggered once the 'on-site' booking is completed
          console.log('Schedule HOOK');
          console.log(data);
          console.log('------------');
        },
        Purchase: function (success = null, error = null, data) {
          //triggered once an online booking is completed
          console.log('Purchased HOOK');
          console.log(data);
          console.log('------------');
        },
        beforeBooking: function (success = null, error = null, data) {
          //triggered when the "Confirm" button is clicked but before the booking is completed.
          //This hook currently doesn't work for Mollie and WooCommerce payments
          console.log('Before booking is created HOOK');
          console.log(data);
          console.log('------------');
        }
      };
    </script>
    

    These are the same hooks used in Google Analytics and Facebook Pixel integrations, but if you need some other hooks added, please let us know which ones and explain what they would contain and when they should be triggered.


    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Olaf replied

    Hi Uros,
    My question is actually about these hooks:

    https://wpamelia.com/amelia-hooks/

  •  1,177
    Uroš replied

    Hello Olaf,

    Thank you for clearing that up.

    I have passed your question to our developers and will provide you with an update on this as soon as possible.


    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1,177
    Uroš replied

    Hello Olaf,

    Thank you for your patience.

    If you want the subscription to go through even if the booking fails and is not added (like if the payment fails) you should use amelia_before_booking_added and amelia_before_appointment_added. The booking hooks are for the booking form where clients book and appointment hooks are for the backend. 

    If you are going to update appointments from the backend and change this custom field than you should also implement the amelia_before_appointment_updated hook, for consistency.

    Also the appointmentData should have the custom fields inside the bookings array, under customFields. This will be an array of all custom fields and if the checkbox is selected it will have a the label under value, if not the value array will be empty.


    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Olaf replied

    Thanks Uros, that was exact the information I need.

  •  1,177
    Uroš replied

    Hello Olaf,

    Glad to be able to assist you and my apologies for the first response.

    Please let me know if you have any other questions.


    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables