Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DOC

Guide for Bagisto Chatbot Using OpenAI ( ChatGPT ) LLM

The Bagisto Chatbot module lets shoppers search your catalog, build a cart, and check out in one conversation.

A single agent, built on the Laravel AI SDK, picks the right tool for each question. It also remembers earlier turns in the conversation.

Discover our premium-quality Bagisto Extensions to extend and enhance your store.

Requirements of Bagisto Chatbot

  • Bagisto: v2.5.0
  • PHP: 8.4 or later
  • Database: MySQL, MariaDB or PostgreSQL
  • Search: Elasticsearch 8.x, or MariaDB 11.7 or later
  • MagicAI: installed, with at least one AI provider key

Features of Bagisto Chatbot

  • The admin enables the chatbot and picks the AI model under Configuration>Chatbot>General.
  • Customers ask about products, prices, and stock in plain words.
  • Semantic product search runs on Elasticsearch, or natively on the MariaDB VECTOR type with no extra search cluster.
  • Catalog queries find the cheapest item, the priciest one, a price range, or a product count.
  • Customers add items to the cart, view it, remove items, and update quantities in the chat.
  • A full checkout flow saves addresses, picks shipping and payment, and places the order.
  • Answers come from any AI provider you set up in MagicAI, including OpenAI, Anthropic, Gemini, and Mistral.
  • Chat memory lets customers ask follow-up questions with no repeats.
  • Guests keep their chat history with a cookie, and a command clears old history.
  • Products, categories, and CMS pages stay indexed automatically and in sync.
  • Every Bagisto product type works: Simple, Virtual, Configurable, Grouped, Bundle, Downloadable, and Booking.
  • Runs on MySQL, MariaDB, and PostgreSQL, with or without a table prefix, in 22 languages.
  • Supports Bagisto v2.5.0.

Installation of Bagisto Chatbot

First, choose a search driver and an AI provider. Then follow the steps below to install the module.

Step 1: Extract the extension

Unzip the extension and merge the packages folder into the root directory of your Bagisto project.

Step 2: Configure autoloading

Next, open the composer.json file and add the following line under ‘psr-4‘.

"Webkul\\Chatbot\\": "packages/Webkul/Chatbot/src"

Step 3: Register the service provider

Then open the bootstrap/providers.php file and add the following line under Provider:

Webkul\Chatbot\Providers\ChatbotServiceProvider::class,

Step 4: Complete the setup

After that, run these commands from the project root.

composer dump-autoload
php artisan migrate
php artisan optimize:clear

The migration creates a table only for the MariaDB driver, and only on MariaDB 11.7 or newer. On any other database it does nothing, so it is safe to run.

Step 5: Index existing data

Finally, index the products, categories, and CMS pages into the active search driver.

php artisan chatbot:index

You can also index one entity type at a time.

php artisan chatbot:index --type=products
php artisan chatbot:index --type=categories
php artisan chatbot:index --type=pages

To clear the store before indexing, run the command with the fresh option.

php artisan chatbot:index --fresh

After that, the module indexes new and changed products, categories, and pages through queued jobs. So keep a queue worker running.

Guest conversations build up over time. Therefore, schedule this command to clear old ones, which uses thirty days by default.

php artisan chatbot:cleanup-guests

Choosing a Search Driver for Bagisto Chatbot

Elasticsearch stays the default. It needs a running Elasticsearch 8.x cluster that Bagisto can reach.

If you do not want a second search service, switch to the MariaDB driver. It keeps vectors in a native VECTOR column and finds the closest ones.

This driver needs MariaDB 11.7 or newer. The admin panel shows the option only when your connection supports it.

Pick the Bagisto Chatbot driver under Configuration>Chatbot>General in the Search Driver field.

Then reindex your catalog with chatbot:index –fresh, because each driver keeps its own store.

Generate OpenAI Key for Bagisto Chatbot

The chatbot works with any AI provider that MagicAI supports. This walkthrough uses OpenAI as an example.

First, create an OpenAI account and log in to the OpenAI dashboard.

OpenAI dashboard

Next, click the API Keys option in the sidebar.

OpenAI API Keys page

Then click the Create New Secret Key button. A pop-up appears to create the key.

Create secret key pop-up

After that, copy the key with the Copy button in the pop-up.

Generated OpenAI key

Admin Configuration of Bagisto Chatbot

Add the AI provider key

Open Configuration>Magic AI>Providers in the admin panel and paste the key there. This enables the provider for the chatbot.

Magic AI provider configuration for Bagisto Chatbot

Enable the chatbot

Next, open Configuration>Chatbot>General. Then turn on Status to show the chatbot on the storefront.

Also select the Model and the Search Driver here. If you leave the model empty, the chatbot uses the MagicAI default.

Bagisto Chatbot configuration in the admin panel

Set the chat window

You can also set the chat window title and the bot avatar in the same section.

Storefront Workflow of Bagisto Chatbot

First, shoppers click the Bagisto Chatbot icon on the storefront.

Bagisto Chatbot icon on the storefront

The chatbot greets the shopper, and the shopper then states the need in their own words.

The agent picks the right tool for the question: product search, catalog lookup, cart, or checkout. Then it answers.

Follow-up questions keep the earlier context, so shoppers refine results fast.

Bagisto Chatbot conversation on the storefront

When a shopper is ready, they add a product to the cart and give an address. After that, they choose shipping and payment, and confirm the order in the chat.

The chatbot always asks you to confirm before it places an order.

Shoppers can still open a product link and check out on the full product page.

Support

So, that was a bit about the Bagisto Chatbot extension. For any queries, contact us at the Webkul Support System.

You can also add an AI shopping assistant to your Bagisto Laravel E-commerce platform.

You may also check our quality Bagisto Extensions.

Current Product Version - v2.5.0

Supported Framework Version - v2.5.0

Blog Version - v2.5.0
  • Version v2.5.0
  • Version v2.4.11
  • Version v2.4.0
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home
IN THIS ARTICLE

Table of Content

Back to top