Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility update to support Joomla 4 and Mautic 4 #37

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

LadySolveig
Copy link

@LadySolveig LadySolveig commented Apr 14, 2023

What's changed

  • separated Mautic API Package - moved from plugin to own library
  • create package with plugin and library
  • changed API authorization method - supports only OAuth2
  • change registered user add to mautic as contact instead of lead (Mautic 4)
  • updated Readme
  • moved Update.xml to main respository
    Additional
  • added tracking image for noscript
  • added embed tags shortcode from mautic instance
  • updated regex for fixing bug with dynamic content emedding
    TODO
  • improve custom additional params in tracking script - not working at the moment
  • change link in the update.xml to a release package and change also link to updateserver in mautic.xml to your needs
    IMPORTANT
    This version only supports Joomla 4.x.x and Mautic 4.x - no backward compatibility with previous versions

MauticForJ4_2_0_0-rc.zip

Fixes #35 #36

- separated Mautic API Package - moved from plugin to own library
- create package with plugin and library
- changed API authorization method - supports only OAuth2
- change registered user add to mautic as contact instead of lead (Mautic 4)
- updated Readme
Additional
- added tracking image <noscript>
- added embed tags shortcode from mautic instance
TODO
- improve custom additional params in tracking script - not working at the moment
IMPORTANT
This version only supports Joomla 4.x.x and Mautic 4.x - no backward compatibility with previous versions
@cla-bot cla-bot bot added the cla-signed label Apr 14, 2023
Copy link
Sponsor Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @LadySolveig for making this PR and sorry it has taken me so long to get it reviewed. I have taken a first pass just looking at the text and spotted a few things. I will ask any of the core team to make a code review as well.

Findings from testing:

On install the flash message indicated that I should click to configure, taking me to administrator/index.php?option=com_plugins&filter_search=mautic - but this did not actually filter the list of plugins - I had to manually type 'Mautic' into the search filter (minor inconvenience!)

Enabling the plugin seems to work great - I already had it installed and it seems to have upgraded without any problems.

I see the update site pointing at the repo: http://mautic.github.io/mautic-joomla/updateserver.xml - I have enabled https for those resources so we can update that.

When I auth the plugin I see %Joomla% in the text - maybe we can make that a bit better for the user? Perhaps just removing the % would be a good start.

screenshot-8080-mautic-mautic-oj3o901zusf ws-eu97 gitpod io-2023 05 16-12_36_38

Finally, I struggled to get this to auth properly:

{"errors":[{"message":"The redirect URI provided does not match registered URI(s).","code":400,"type":"redirect_uri_mismatch"}]}

I checked that the URI in the API settings is the correct admin URL for the Joomla site so not sure what that is about - any thoughts?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
plg_system_mautic/README.md Outdated Show resolved Hide resolved
@RCheesley RCheesley mentioned this pull request May 16, 2023
1 task
LadySolveig and others added 3 commits May 17, 2023 14:53
Readme and Update-Server

Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>
Readme

Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>
@LadySolveig
Copy link
Author

@RCheesley thank you very much for your review.
I commited your changes for the readme and fixed the broken search query from the flash install message.

The page you see when you first authenticate is created by Mautic and the "%" are not present in the current stable release.
The descriptive name "Joomla" in your example is the name you give it on the Mautic API configuration page. In my case 'Test'.
twig oauth mautic4
oauth mautic4-j4-3

I assume you tested with Mautic version 5. The authorization template has changed. Maybe the "%" comes from the view. I found the following lines in this context.
twig oauth mautic5
twig oauth mautic5-2

I installed the zip that I provided in this pull request and tested the API-Connection on the current Joomla Version 4.3.1 and current stable Mautic version 4.4.8. I'm sorry, I can't reproduce your issue with the connection.

That's my result with the default redirect path 'administrator'

oauth mautic4-j4
oauth mautic4-j4-2


> #Date: 2023-05-17 18:12:26 UTC
> #Software: Joomla! 4.3.1 Stable [ Bora ] 2-May-2023 16:00 GMT
> 
> #Fields: datetime	priority clientip	category	message
> 2023-05-17T18:12:26+00:00	INFO 91.57.190.240	plg_system_mautic	Authorize method called.
> 2023-05-17T18:13:34+00:00	INFO 91.57.190.240	plg_system_mautic	Authorize method called.
> 2023-05-17T18:13:34+00:00	INFO 91.57.190.240	plg_system_mautic	authorize::accessTokenData: Joomla\Registry\Registry::__set_state(array(
>    'data' => 
>   (object) array(
>      'token' => 
>     (object) array(
>        'access_token' => 'M2E3NTFlN2MzNDZmZWQ5MTY3MWU4NTdlNzliMWYzNDk4OWE5ZGZmOGFhNDhlYTM2NDM4ZTJjY2Q1MjljYWY3OQ',
>        'expires' => 1684350814,
>        'token_type' => 'bearer',
>        'refresh_token' => 'NDZkODM1N2Y1NGE3YzBkMjliMDBiY2M1M2U0NzZkNDllNTVkNDY3ZmU3MGVlMjlhNzMzNDEzYWU1NTA5NzZlYQ',
>        'created' => '2023-05-17 18:13:34',
>     ),
>   ),
>    'initialized' => true,
>    'separator' => '.',

Can you please give me a hint on which versions you tested ?
Additionally, the Joomla log file named plg_system_mautic.php from folder administrator/logs would be very helpful.

@RCheesley
Copy link
Sponsor Member

RCheesley commented Aug 16, 2023

Hi there,

I went back to test this again - still getting the %Joomla Integration% so might be something that we need to look into for the 5.x branch - would you mind raising it as a bug?

I am still getting the auth error:

{"errors":[{"message":"The redirect URI provided does not match registered URI(s).","code":400,"type":"redirect_uri_mismatch"}]}

I am testing with Mautic 5.x branch, and the git clone from the 4.3-dev branch of Joomla (before I was just using a regular 4.2.x Joomla install as I was testing on the dev area of my own website - this time I spun up a local instance for testing).

Here's the content of the log file:

#
#<?php die('Forbidden.'); ?>
#Date: 2023-08-16 14:48:04 UTC
#Software: Joomla! 4.3.4-rc2-dev Development [ Bora ] 15-August-2023 16:01 GMT

#Fields: datetime	priority clientip	category	message
2023-08-16T14:48:04+00:00	INFO 172.18.0.8	plg_system_mautic	Authorize method called.

In the Mautic side I have the redirect URI set to https://mautic.ddev.site/administrator and the Joomla side has the base URL set as https://mautic.ddev.site and the callback path as administrator.

Please let me know if I'm maybe setting something incorrectly!

@LadySolveig
Copy link
Author

@RCheesley nice to hear from you. I paused the project at the moment. Thank you for your infos. I will look into this the next 2 or 3 weeks give you feedback. I will also test with the new Joomla 5 version so we can go forward with this side project.

@mautibot
Copy link

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/joomla-4-extension-update/23021/4

@RCheesley
Copy link
Sponsor Member

Hey @LadySolveig I finally got around to testing this again but this time on my live site, and I've managed to auth properly! 🥳

Works absolutely beautifully with the tracking!

Few things I found:

screenshot-m ruthcheesley co uk-2024 03 15-23_41_59

Form embed works great:

screenshot-ruthcheesley co uk-2024 03 15-23_46_18

Gated video also working as expected:

screenshot-ruthcheesley co uk-2024 03 15-23_48_37

I could not seem to get the DWC firing as I'd expect - it's just showing the default content despite matching on various fields (e.g. country for an anon visitor, or first name for a known visitor) but might be a separate issue.

Otherwise, awesome work!

Copy link
Sponsor Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to leave a formal review, sorry!

@RCheesley
Copy link
Sponsor Member

RCheesley commented Mar 16, 2024

(PS it works great with Mautic 5.0.3 and Joomla 4.4.3 - haven't yet tested with Joomla 5 though!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joomla Mautic Plugin
3 participants