Ecommerce Ad Copy Generator
Overview
Generate 5 conversion-focused ad copies for Facebook / Google / TikTok from structured product input. Charge 0.10 USDT per run before content generation.
Workflow
- 1. Parse and validate input fields:
-
user_id
-
product_name
-
selling_points (list or delimited string)
-
target_audience
- 2. Call SkillPay
POST /billing/charge with amount 0.10 USDT. - If billing succeeds, generate exactly 5 platform-adapted ad copies.
- If billing returns insufficient balance, return
INSUFFICIENT_BALANCE with payment_url. - Return structured JSON output for downstream use.
Run
- - Core script: INLINECODE12
- Test script: INLINECODE13
Run with direct arguments:
CODEBLOCK0
Run with JSON file:
CODEBLOCK1
Run tests:
CODEBLOCK2
Output Contract
Success:
- - INLINECODE14
- INLINECODE15
- INLINECODE16
- INLINECODE17 : exactly 5 items, each containing:
-
platform
-
headline
-
body
- INLINECODE21
Billing failure:
- -
VALIDATION_ERROR for invalid input - INLINECODE23 and
payment_url when top-up is required - INLINECODE25 for non-balance billing failures
Environment Variables
- -
SKILLPAY_CHARGE_ENDPOINT (default: https://skillpay.me/billing/charge) - INLINECODE28 (optional bearer token)
- INLINECODE29 (optional; supports
{user_id}) - INLINECODE31 (default:
https://skillpay.me/pay)
References
- - SkillPay request/response assumptions and fallback behavior: INLINECODE33
电商广告文案生成器
概述
根据结构化产品输入,为Facebook / Google / TikTok生成5条以转化为目标的广告文案。每次运行在内容生成前收取0.10 USDT费用。
工作流程
- 1. 解析并验证输入字段:
- user_id
- product_name
- selling_points(列表或分隔字符串)
- target_audience
- 2. 调用SkillPay POST /billing/charge,金额为0.10 USDT。
- 如果计费成功,则生成恰好5条适配平台的广告文案。
- 如果计费返回余额不足,则返回INSUFFICIENTBALANCE及paymenturl。
- 返回结构化JSON输出供下游使用。
运行
- - 核心脚本:scripts/ecommerceadcopygenerator.py
- 测试脚本:scripts/testecommerceadcopy_generator.py
使用直接参数运行:
bash
python3 scripts/ecommerceadcopy_generator.py \
--user-id user_001 \
--product-name CloudBoost 智能投放器 \
--selling-points 智能出价 多平台同步 分钟级报表 \
--target-audience 跨境电商运营团队
使用JSON文件运行:
bash
python3 scripts/ecommerceadcopy_generator.py --input-file ./payload.json
运行测试:
bash
python3 -m unittest scripts/testecommerceadcopygenerator.py -v
输出约定
成功:
- - success: true
- pricing.amount: 0.10
- pricing.currency: USDT
- copies:恰好5条,每条包含:
- platform
- headline
- body
- cta
计费失败:
- - 输入无效时返回VALIDATIONERROR
- 需要充值时返回INSUFFICIENTBALANCE和paymenturl
- 非余额不足的计费失败返回BILLINGERROR
环境变量
- - SKILLPAYCHARGEENDPOINT(默认值:https://skillpay.me/billing/charge)
- SKILLPAYAPIKEY(可选的Bearer令牌)
- SKILLPAYPAYMENTURLTEMPLATE(可选;支持{userid})
- SKILLPAYTOPUPBASE_URL(默认值:https://skillpay.me/pay)
参考资料
- - SkillPay请求/响应假设及回退行为:references/skillpay-api-contract.md