A few days ago, I saw this tweet on Indonesian X about how sellers are moving to their own marketplace platforms due to increasing e-commerce platform fees:
I remembered a few months ago Payload CMS finally released an update to their e-commerce template. After trying it out, it gives you a really good setup for a basic e-commerce with auth, inventory management, cart, and even payment flow using Stripe (with an option to create integrate your own payment method). It even has marketing features such as SEO and page builder, and of course you can customize Payload CMS in any way you want even white-labelling it to use with multiple clients easily.
In other news, Hermes Agent has been trending recently on the AI space due to it being a "better" version of OpenClaw. After giving Hermes Agent a spin, I got to say it's very capable, easier to setup, and runs better than OpenClaw! I really appreciate how easy it is to setup the agent with your WhatsApp/Telegram and use it like you would message your personal assistant. It also has a lot of built-in tools to do business stuff like analyzing data, drafting emails, and any task you can automate. It even has memory so it remembers who you are better the more you use it.
Considering how much AI agents and LLMs have grown to help automating our tasks and making building products quicker, it wouldn't be crazy to try to build your own e-commerce platform and integrate an actual ai assistant that helps you automate operations so you can focus on important business stuff. In this article, I'll walk you through how to use Payload CMS to build a low-cost e-commerce platform and powering it with Hermes Agent to automatically assist in managing your platform.
What we'll do
We'll setup a basic e-commerce platform complete with auth, inventory management, cart, payment, SEO, and page builder. We won't have to code much since we can just use Payload CMS with its e-commerce template, which basically provides all of those out-of-the-box. Next, we'll setup Hermes Agent locally and connect it to our Payload CMS e-commerce platform using MCP. In the end, we'll have a basic e-commerce platform and an agent we can talk to help manage our platform such as updating the inventory, analyzing user's carts, and even creating blog posts for marketing.
You can clone this project's repo here: ElysMaldov/payload-hermes-ecommerce
Setup Payload CMS with e-commerce template
Make sure you've setup your environment to install Payload CMS, then follow the e-commerce template quickstart. For this tutorial, we'll be using SQLite for the database, but you can use any DB you want.
Once finished, you can run the program with pnpm dev. I won't go into details about how Payload CMS nor this template works, but just know now we have 2 apps in this 1 project that you can customize however you want:
The client facing e-commerce platform in localhost:3000:

And the admin dashboard in localhost:3000/admin:

Exploring Payload CMS E-commerce
On the first run, follow the instructions to open the admin dashboard, create your first admin account, seed the database, and go try out the features Payload provides. Optionally, you can create a Stripe account and give it your sandbox mode API key to try out the payment flow. For my Indonesian fellows, you can create custom Payment methods for Xendit, Midtrans, and any other gateways by following this tutorial: Payment Adapters | Documentation | Payload.
When your database is seeded, you should now able to see the client e-commerce app is updated with new pages, mainly the Shop page:

You can manage your inventory in the admin dashboard by opening the Products collection:

As a customer, you can add items to cart, pick product variants, and pay it on the checkout page. As an admin, you can manage all of these data in the admin dashboard. It's really comprehensive for a e-commerce starter, but the template lacks shipping and activity logs, which you can add your own later.
Setting up Hermes Agent
Follow the docs to install your Hermes Agent. For this tutorial, I'll be using Nous Portal provider, WSL2, and Telegram Bot to communicate with the agent. I created a new WSL2 instance just for this tutorial with this command: wsl --install Ubuntu --name PayloadHermesEcommerce, this prevents the agent from messing with my other existing WSLs. We can assume the agent is working if you can chat with it through the messaging gateway you setup (for me it's Telegram).

Integrating Hermes with Payload using MCP plugin
Currently, our Hermes Agent can't really communicate with our Payload app. Sure, we could prompt it to learn our Payload app's API endpoints and make skills/tools for it, but a much more organized way is using MCP. We first need to setup Payload MCP Plugin, this gives us an organized method to control what our agent can access on our Payload app. Once the MCP server is setup, you can enable/disable which collections and other data your agent can utilize through the MCP. For this tutorial, I enable all the e-commerce collections.
mcpPlugin({
collections: {
addresses: {
enabled: true,
},
carts: {
enabled: true,
},
categories: {
enabled: true,
},
forms: {
enabled: true,
},
media: {
enabled: true,
},
orders: {
enabled: true,
},
pages: {
enabled: true,
},
products: {
enabled: true,
},
transactions: {
enabled: true,
},
users: {
enabled: true,
},
variantOptions: {
enabled: true,
},
variants: {
enabled: true,
},
variantTypes: {
enabled: true,
},
'form-submissions': {
enabled: true,
},
},
})
Next, you need to configure the MCP client in Hermes Agent config. Open your .hermes/config.yaml and add this section:
mcp_servers:
PayloadHermesEcommerce:
type: "http"
url: "http://windows.local:3000/api/mcp"
headers:
Authorization: "Bearer API-KEY-HERE"
Replace your API-KEY-HERE with the API key you get from Payload CMS API Keys collection in the admin dashboard that was created from the MCP plugin.
Sidenote: your MCP setup might be different from mine, since I run my Hermes Agent on WSL2, I created a custom host windows.local to target my Window host IP address and reach my Payload through localhost:3000, if you run the Payload in another server or alongside where Hermes Agent is running, you might be able to just use localhost or target the Payload host directly.
Now run your Payload app and call /reload-mcp on your Hermes Agent. If it works, you should see a success message informing PayloadHermesEcommerce MCP has been added to the agent. I used PayloadHermesEcommerce for a more descriptive name. To test out that the MCP works, try asking your Hermes about what products your e-commerce have:
What products does my e-commerce have?
Hermes will use the tools provided in the MCP and return products from your platform.
Things you can do with the integration
Now it's the fun part! With the MCP running, you are able to manage your Payload e-commerce platform in multiple ways. Let's try researching new products and adding it to the listing by sending this message to the agent through Telegram.
Research 3 Y2K styled clothing items and add them to our platform. Make sure each item has at least 1 image you download from the internet to the gallery and descriptive details. Make sure you fill out the SEO details completely.
Next, let's make a few fake users and transactions, then create a PDF report about our store's performance:
Please make 3 fake customers and 20 fake transactions with variative orders, status, and total. Then, create a PDF report about how our platform is performing and recommendations to improve our sales.
There are multitude of ways you can utilize this integration:
- Setup cron job to research the market and update the product listing daily
- Research and write blog posts or promotion pages with good SEO for your products
- Analyze stale carts and automatically send personalized emails to remind the user
- Ask about transaction and orders data to create PDF/Excel reports
- Feed Hermes with your business information to build a FAQ database
- Integrate chatbot feature on the e-commerce client app with distinct personality
- Many more! You can ask Hermes to do all of that just through your Telegram, WhatsApp, and any other messaging gateway you setup. This gives admins an easy way to operate your e-commerce platform.
Deployment
I won't go into details on how to deploy this but since Payload CMS is a Next.js app, you can deploy it in Vercel and any other methods such as a VPS. For Hermes Agent, you can deploy it to a VPS and set up the Payload MCP to direct to your deployed Payload app. If you use another database such as Postgres, you need to also deploy and manage that. Since you own the source code and agent setup, you are able to optimize your infrastructure cost based on your needs.
Conclusion
AI agents are developing super quickly and its making building products and automating tasks accessible to a wider range of audience. By using Payload CMS e-commerce template with its MCP plugin capabilities, we can create an AI assistant with Hermes Agent that helps automate your e-commerce operations. Since you now own the e-commerce platform and AI agent, you can optimize your expenses.




Top comments (0)