AI Support Chat Integration with Joomla

For Joomla! 5.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
nexai
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Apr 26, 2024 1:14 pm

AI Support Chat Integration with Joomla

Post by nexai » Fri Apr 26, 2024 1:44 pm

Hello,

I've build an AI based support Chat as a React Component.

I'd like to get this chat component integrated into Joomla. I used to do Joomla development many years ago but haven't in around 5+ years so I'm no longer in touch with the ecosystem.

The AI support chat is hosted on my website so the integration with Joomla may be minimal. The chat support is a little chat bubble that shows on the bottom right of the site.

## Questions:

Where can I get an example of a Joomla component that integrates a 3rd party React UI Component into Joomla?

Is there a git repository template to start building a joomla component or module or plugin?

Can I integrate the Joomla users into the React Component somehow? I'd like the chat to use the Users name, and email and send this to the Chat service so the Assistant knows the users they are talking to.

Do I have to re-do the whole React Component as a Joomla Module? Or Component? Or can I just integrate the React Component as a plugin etc.

If you know any other services doing this please let me know.

See the chat at the bottom right of: [ redacted ]

Image
Last edited by toivo on Fri Apr 26, 2024 10:38 pm, edited 1 time in total.
Reason: mod note: moved from 5.x Extensions, removed link to non-Joomla website - please observe the forum rules!

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44119
Joined: Sat Apr 05, 2008 9:58 pm

Re: AI Support Chat Integration with Joomla

Post by Webdongle » Fri Apr 26, 2024 3:23 pm

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

nexai
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Apr 26, 2024 1:14 pm

Re: AI Support Chat Integration with Joomla

Post by nexai » Sat Apr 27, 2024 4:33 pm

Hi,

Thanks so much for the links.

What I'm most interested in is the integration of a 3rd party service with Joomla.

How would you authenticate Joomla users into your 3rd party app?

What I've come up with so far is to just:

Code: Select all

define('_JEXEC', 1);
define('JPATH_BASE', __DIR__); // Assuming this script is in the root of your Joomla installation
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';

// Get the Joomla application instance
$app = JFactory::getApplication('site');

// Get the current user object
$user = JFactory::getUser();

// Check if the user is logged in
if ($user->guest) {
    // User is not logged in
    $userData = null;
} else {
    // User is logged in, retrieve user details
    $userData = array(
        'id' => $user->id,
        'name' => $user->name,
        'username' => $user->username,
        'email' => $user->email
        // Add any other user details you need
    );
}

// Encode user data to JSON
$userJson = json_encode($userData);
To show the logged in user information. I then just retrieve this into the react chat component via an api.

I'm not sure this is the correct way of it there is a proper API for integrating 3rd party components in Joomla now.

The key integration points are:

Authentication within Joomla and within 3rd party app (written in NodeJS and has an OAuth API).
Can Joomla authenticate users via OAuth or can that be built on top of a 3rd party plugin?
Can Joomla API show all the pages created with it's content and metadata?

At the moment I'm getting the menu items but I'd prefer to get actual data and not have to crawl each menu URL over HTTP.

Code: Select all

$nexai = new Nexai(apiKey);
$query = $dbo->getQuery(true);
$query->select($dbo->quoteName(array('id', 'title', 'alias')));
$query->from($dbo->quoteName('#__menu'));
$query->where($dbo->quoteName('published') . ' = 1'); // Assuming you only want published pages

$dbo->setQuery($query);
$results = $dbo->loadObjectList();

if ($results) {
    echo "<ul>";
    foreach ($results as $page) {
        $url = JRoute::_('index.php?Itemid=' . $page->id);
        $nexai->add($url, ['title' => $title]);
    }
    echo "</ul>";
}

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44119
Joined: Sat Apr 05, 2008 9:58 pm

Re: AI Support Chat Integration with Joomla

Post by Webdongle » Sat Apr 27, 2024 6:47 pm

Found https://docs.joomla.org/J4.x:Creating_a ... for_Joomla
not sure if this is what you are looking for?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

nexai
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Apr 26, 2024 1:14 pm

Re: AI Support Chat Integration with Joomla

Post by nexai » Sat Apr 27, 2024 8:49 pm

Thanks for that. Very helpful. I'm wanting to only observe the authentication however and not actually authenticate the user. I'll have to test around. Anyone know if an auth plugin can just observe if the auth process succeeded?

Reason is that I want to know if auth succeeded and then forward this to our end to give access to the user - eg: to send them AI support chat's project wide if they are an admin.


Post Reply

Return to “Joomla! 5.x Coding”