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?
<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.
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.
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
Hello Olaf,
Amelia currently has the following hooks:
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 | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
Hi Uros,
My question is actually about these hooks:
https://wpamelia.com/amelia-hooks/
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 | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
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 | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
Thanks Uros, that was exact the information I need.
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 | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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