Joomla Contact Form Integration - Authorisation

I’ve created a Joomla plugin that overrides the default contact email that allows the user to override the contact form itself along with sending customer html emails.



So far I’ve integrated HubSpot to have leads sent to the CRM, this works well.



I’ve added the functionality for using Mautic and sending the information from a contact form request as leads into Mautic, but the plugin is a ‘contact’ type and I need to authorise the application or plugin separately from the default Mautic system plugin, will this work as a contact type plugin or will I need to change it to a system plugin in order authorise the app?



I have tried this but it’s currently not working and I’m guessing it’s because of the plugin type not being loaded on page load. It may then be the case that I can access the credentials from the system plugin and use them instead to send the leads to mautic.



I’ve added the correct authorisation methods and I had to change the helper class as it was giving the fatal error that it was already loaded.



Any help would be appreciated.



Derek

I’ve created a Joomla plugin that overrides the default contact email that allows the user to override the contact form itself along with sending customer html emails.

So far I’ve integrated HubSpot to have leads sent to the CRM, this works well.

I’ve added the functionality for using Mautic and sending the information from a contact form request as leads into Mautic, but the plugin is a ‘contact’ type and I need to authorise the application or plugin separately from the default Mautic system plugin, will this work as a contact type plugin or will I need to change it to a system plugin in order authorise the app?

I have tried this but it’s currently not working and I’m guessing it’s because of the plugin type not being loaded on page load. It may then be the case that I can access the credentials from the system plugin and use them instead to send the leads to mautic.

I’ve added the correct authorisation methods and I had to change the helper class as it was giving the fatal error that it was already loaded.

Any help would be appreciated.

Derek

Ok so I changed my plugin code to use the already authorised system plugin, the contact plugin I created now uses the already loaded mauticApiHelper class if it exists, I am now a little further forward.

The error returned from the class on trying to create a lead is as follows:

leadApi::create - response: 404: Requested URL not found: /api/leads/new

Any ideas?

I worked out that the plugin and Mautic library shipped with the Joomla plugin is referencing old code, leads, for instance, was dropped a while back and the context ‘contacts’ is now used so the getContext also required to be updated.

I have successfully added a lead now, time to do some more cleaning and testing before moving to production.

I use Joomla a lot so will update the main plugin and make it available.

Derek

[quote=18219:@DerekBuntin]I worked out that the plugin and Mautic library shipped with the Joomla plugin is referencing old code, leads, for instance, was dropped a while back and the context ‘contacts’ is now used so the getContext also required to be updated.

I have successfully added a lead now, time to do some more cleaning and testing before moving to production.

I use Joomla a lot so will update the main plugin and make it available.

Derek[/quote]
That’s awesome Derek! I use Joomla! a lot too and was wondering about this too.

If you need somebody for testing let me know.

Hi menolo,

Sure, I have this working well with the code at the moment but will redevelop the plugin to use the new methods as it’s much cleaner.

At the moment I created a new method in the system plugin, which uses the already authorised app, called ‘addContact’, this is called in my own ‘autorespond’ plugin which is called when the user submits the contact form, this essentially overrides the email content functionality and adds HTML emails to both admin and the user with a signature, it also hooks up to HubSpot if you use that CRM.

What I plan on doing now is integrating contact fields for mapping and adding the ability to override the contact form with an override XML file meaning you can collect more data at the point of contact rather than the default that comes shipped with Joomla.

When I update the plugin I’ll let you know, the core functionality is nearly ready so will make that available shortly.

Thanks
Derek

Hey Derek,

Just so I understand:

  • you’re making an autorespond plugin for sending data to Mautic and Hubspot CRM from the com_contact form.
  • you’re overriding com_contacts’ form xml to add some extra form fields to the contact form. These fields can be mapped to mautic and hubspot crm fields.

Right?

I don’t use com_contacts in most of my sites. I’ve been thinking a mautic plugin for RSForm Pro would be cool as wel.

[quote=18231:@menolo]Hey Derek,

Just so I understand:

  • you’re making an autorespond plugin for sending data to Mautic and Hubspot CRM from the com_contact form.
  • you’re overriding com_contacts’ form xml to add some extra form fields to the contact form. These fields can be mapped to mautic and hubspot crm fields.

Right?

I don’t use com_contacts in most of my sites. I’ve been thinking a mautic plugin for RSForm Pro would be cool as wel.[/quote]

That’s correct.

I created an autorespond plugin for com_contact a while back so that we can send custom replies to customers, you can select the custom reply option in the contact params in admin and then call the plugin with the trigger onSubmitContact: , this works well already and was later extended to include the HubSpot API so that you can add users to the CRM.

I’ve now just extended the plugin to call the default mautic plugin and added a new method called addContact to the mautic plugin which now adds the contacts to Mautic.

What I’m going to do now is:

  • Create a new Mautic plugin with the new coding structure.
  • Integrate contacts fields for mapping fields to mautic and HubSpot that are collected from the contact form.
  • Provide a method to override the default form XML file so we can add the custom fields to Joomla integrating both HubSpot and Mautic since HubSpot requires a minimum of 5 fields in order to validate the contact - I have manually done this already but will programmatically create a way to add these from admin instead.

I also use RSForm for our clients so that’s also on the list and should be fairly simple to implement.

I hope this makes sense

Kind Regards
Derek

Makes perfect sense Derek. Thanks for explaining in such a thorough manner.

Hey Derek. Sounds amazing. I will be giving RSFormPro a shot later but expect I might end up with less hair than I started. I will feed back if I win but expect that you might just get there sooner. Thanks for the head-start though :wink: