angeo/module-openai-product-feed-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

angeo/module-openai-product-feed-api

Composer 安装命令:

composer require angeo/module-openai-product-feed-api

包简介

Magento 2 REST API for the OpenAI Agentic Commerce Protocol (ACP). Implements the ACP feed API surface: feeds, paginated products with configurable variants, and SalesRule-sourced promotions. Bearer-token authenticated, DB-persisted feeds, PATCH-as-POST bridge for Magento compatibility.

README 文档

README

Latest Version Total Downloads License PHP Version Magento ACP Feed API

Magento 2 REST implementation of the OpenAI Agentic Commerce Protocol (ACP) feed API: Feeds, Products and Promotions resources, so ChatGPT can retrieve and update your catalog data through API-based delivery instead of (or alongside) daily file uploads.

All endpoints are bearer-token authenticated per the ACP specification. Feeds are persisted in the database (they survive cache flushes and restarts), product export is fully paginated with configurable-product variants, and promotions are sourced from Magento Cart Price Rules including coupon codes and free shipping.

Works together with angeo/module-openai-product-feed (CSV file-upload feed): per OpenAI's guidance, provide the full feed daily via file upload and send incremental updates through this API.

Requirements

  • PHP >= 8.1
  • Magento 2.4.x (Open Source or Adobe Commerce)
  • angeo/module-openai-product-feed ^2.0

Installation

composer require angeo/module-openai-product-feed-api
bin/magento setup:upgrade
bin/magento cache:flush

Authentication (required)

Every endpoint requires a bearer token carrying the Angeo_OpenAiProductFeedApi::manage_feeds ACL resource, matching the ACP requirement that requests include Authorization: Bearer <api_key>.

  1. In the Magento admin, go to System → Extensions → Integrations → Add New Integration.
  2. On the API tab, select the resource Angeo — Manage Product Feed API (under Marketing).
  3. Save, then Activate the integration and copy the Access Token.
  4. Provide that token to OpenAI as the feed API key; use it in the Authorization: Bearer header for your own calls as well.

Requests without a valid token receive 401 Unauthorized.

Endpoints

Method Path Description
POST /rest/V1/angeo/product_feeds Create a product feed
GET /rest/V1/angeo/product_feeds List all feeds (extension beyond the ACP spec)
GET /rest/V1/angeo/product_feeds/:id Get feed metadata
GET /rest/V1/angeo/product_feeds/:id/products Get products (paginated)
POST /rest/V1/angeo/product_feeds/:id/products/upsert Upsert products (PATCH bridge)
POST /rest/V1/angeo/product_feeds/:id/products/invalidate Reset product cache for the feed
GET /rest/V1/angeo/product_feeds/:id/promotions Get promotions
POST /rest/V1/angeo/product_feeds/:id/promotions/upsert Upsert promotions (PATCH bridge)

Invalid target_country returns 400 Bad Request; unknown feed or store IDs return 404 Not Found, per the ACP error model.

PATCH bridge — web server setup

Magento 2's REST framework does not support HTTP PATCH. The ACP spec defines upserts as PATCH /product_feeds/:id/products. Bridge this with a rewrite before the request reaches Magento:

# nginx — add inside your server {} block
location ~ ^/rest/V1/angeo/product_feeds/[^/]+/products$ {
    if ($request_method = PATCH) {
        rewrite ^(.*)$ $1/upsert last;
    }
}

location ~ ^/rest/V1/angeo/product_feeds/[^/]+/promotions$ {
    if ($request_method = PATCH) {
        rewrite ^(.*)$ $1/upsert last;
    }
}
# Apache — .htaccess in the Magento root
RewriteCond %{REQUEST_METHOD} ^PATCH$
RewriteRule ^rest/V1/angeo/product_feeds/([^/]+)/products$ rest/V1/angeo/product_feeds/$1/products/upsert [L]
RewriteCond %{REQUEST_METHOD} ^PATCH$
RewriteRule ^rest/V1/angeo/product_feeds/([^/]+)/promotions$ rest/V1/angeo/product_feeds/$1/promotions/upsert [L]

Quick start

TOKEN="<integration access token>"

# 1. Create a feed
curl -X POST https://yourstore.com/rest/V1/angeo/product_feeds \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"targetCountry":"US","storeId":1}'
# → {"id":"feed_a1b2c3d4e5f6","target_country":"US","store_id":1,"updated_at":"...","created_at":"..."}

# 2. Get products (page 1, 100 per page)
curl -H "Authorization: Bearer $TOKEN" \
  "https://yourstore.com/rest/V1/angeo/product_feeds/feed_a1b2c3/products?page=1&pageSize=100"

# 3. Upsert products (POST to /upsert; OpenAI's PATCH is rewritten by nginx)
curl -X POST https://yourstore.com/rest/V1/angeo/product_feeds/feed_a1b2c3/products/upsert \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"feedId":"feed_a1b2c3","products":[{"id":"42","variants":[{"id":"43","title":"Black / M"}]}]}'
# → {"id":"feed_a1b2c3","accepted":true,"upserted_count":1,"errors":[]}

# 4. Get promotions (sourced from Magento Cart Price Rules)
curl -H "Authorization: Bearer $TOKEN" \
  https://yourstore.com/rest/V1/angeo/product_feeds/feed_a1b2c3/promotions

# 5. Reset the product cache after catalog changes
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://yourstore.com/rest/V1/angeo/product_feeds/feed_a1b2c3/products/invalidate

How caching works

  • Catalog snapshot — built from the Magento catalog on the first GET, persisted until invalidated. Store-scoped feeds are built under frontend store emulation, so URLs, currency and locale match the store view.
  • Upsert overlay — products received via PATCH/upsert are stored separately and merged over the snapshot at read time (overlay wins). Catalog rebuilds never discard upserted products.
  • Page slices — formatted responses are cached for 30 minutes with their own tag; any upsert invalidates them immediately.
  • /invalidate — full reset for the feed: snapshot, overlay and pages.

Configuration

Stores → Configuration → Angeo → Product Feed API

Setting Description Default
Enabled Enable/disable the API Yes
Default Target Country ISO 3166-1 alpha-2, validated on feed creation US
UTM Medium Appended to all product URLs for attribution feed
Include List Price Original price when a special price is active Yes
Include Barcodes Read EAN/UPC/GTIN attributes Yes
Seller Name Store/brand name in ACP responses Store name
ToS / Privacy / Refund / Shipping / FAQ URLs Emitted as seller.links

ACP Product schema coverage

Field Source
id product.entity_id — stable, never changes
title Product name
description.plain / description.html description / short_description
url Product URL + utm_medium + utm_source=chatgpt
media Gallery images via Magento's ImageUrlBuilder
variants[].id / title Configurable children, or the product itself
variants[].price / list_price Final price / original price, minor units (cents)
variants[].availability Stock status → in_stock / out_of_stock
variants[].categories Category names, merchant taxonomy
variants[].variant_options Configurable attribute labels/values (color, size, …)
variants[].barcodes ean / upc / gtin / barcode / isbn attributes
variants[].condition ["new"]
variants[].seller Name + policy links from configuration

ACP Promotion schema coverage

Sourced from active Magento Cart Price Rules (SalesRules):

Magento SalesRule ACP field
rule_id id as promo_rule_{id}
name title
description + coupon code (via CouponRepositoryInterface) description.plain
is_active + dates status: active / scheduled / expired / disabled
from_date / to_date active_period (RFC 3339)
by_percent {type:"percent_off"}
by_fixed / cart_fixed {type:"amount_off"} (minor units)
simple_free_shipping {type:"free_shipping"} — combinable with a discount benefit

Testing

vendor/bin/phpunit -c app/code/Angeo/OpenAiProductFeedApi/phpunit.xml

The PromotionMapper suite (14 tests) covers benefit mapping, free-shipping detection, coupon-code resolution and status transitions.

The Angeo agentic commerce suite

Module Purpose
angeo/module-openai-product-feed OpenAI CSV product feed (file upload, all product types)
angeo/module-openai-product-feed-api This module — ACP REST API
angeo/module-ucp Universal Commerce Protocol discovery + MCP binding
angeo/module-mcp-server Read-only commerce tools over MCP
angeo/module-llms-txt llms.txt AI content map
angeo/module-aeo-audit AEO readiness audit

Need help with agentic commerce for Magento? Professional support, AEO audits and implementation at angeo.dev. Check how your store looks to AI agents with the free scanner at api.angeo.dev.

Questions? Contact me at info@angeo.dev

License

MIT — see LICENSE

angeo/module-openai-product-feed-api 适用场景与选型建议

angeo/module-openai-product-feed-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 04 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「acp」 「magento2」 「aeo」 「openai」 「ChatGpt」 「agentic commerce」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 angeo/module-openai-product-feed-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 angeo/module-openai-product-feed-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 angeo/module-openai-product-feed-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 32
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-18