Google Play:Android Publisher API 和托管 OAuth - Openclaw Skills
什么是 Google Play 集成?
Google Play 技能为与 Android Publisher API 交互提供了一个流线型界面。它通过提供托管网关消了手动 OAuth 令牌管理的复杂性。这允许开发者通过单个 Maton API 密钥自动化更新应用列表、管理应用内产品以及回复用户评价等任务。
通过将这些功能集成到 Openclaw Skills 中,开发者可以为整个 Google Play 应用生命周期构建强大的自动化工作流。该技能充当 androidpublisher.googleapis.com 的安全代理,自动处理令牌注入和连接持久化。
下载入口:https://github.com/openclaw/skills/tree/main/skills/byungkyu/google-play
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install google-play
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 google-play。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Google Play 集成 应用场景
- 自动化创建和更新应用内产品及 SKU。
- 以编程方式同步订阅数据并处理取消或退款。
- 批量回复用户评价并监控应用反馈。
- 创建并提交应用修改(Edits)以进行事务性元数据更新。
- 监控一次性产品购买并确认交易。
- 用户使用 Maton API 密钥进行身份验证,并通过控制平面创建 Google OAuth 连接。
- 请求发送到 Maton 网关 URL,该网关使用 Authorization 标头或特定的连接 ID 识别正确的 Google 账号。
- 网关自动注入所需的 OAuth 凭据,并将请求代理到官方 Android Publisher API。
- 该技能返回来自 Google 的原始响应,允许在 Openclaw Skills 环境中进行标准数据处理。
- 对于事务性更改,用户创建一个 Edit,修改资源,最后提交更改以将其应用到 Play 商店。
Google Play 集成 配置指南
首先,从 maton.ai 获取您的 API 密钥并配置您的环境:
export MATON_API_KEY="YOUR_API_KEY"
接下来,创建一个到 Google Play 服务的连接:
# 创建一个新的 OAuth 连接
curl -X POST https://ctrl.maton.ai/connections r
-H "Authorization: Bearer $MATON_API_KEY" r
-H "Content-Type: application/json" r
-d '{"app": "google-play"}'
最后,打开响应中返回的 URL 以通过 Google OAuth 授权访问。
Google Play 集成 数据架构与分类体系
该技能使用标准的 Google Play Developer API 结构。核心资源包括:
| 资源 | 用途 | 主要字段 |
|---|---|---|
| 应用内产品 | 管理 SKU 和定价 | sku, status, purchaseType, defaultPrice |
| 订阅 | 经常性收入管理 | productId, basePlans, listings |
| 评价 | 用户反馈和回复 | reviewId, authorName, starRating, comments |
| 修改 (Edits) | 事务性应用更新 | editId, expiryTimeSeconds |
| 购买 | 交易验证 | kind, purchaseToken, consumptionState |
name: google-play
description: |
Google Play Developer API (Android Publisher) integration with managed OAuth. Manage apps, subscriptions, in-app purchases, and reviews. Use this skill when users want to interact with Google Play Console programmatically. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
compatibility: Requires network access and valid Maton API key
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: ??
requires:
env:
- MATON_API_KEY
Google Play
Access the Google Play Developer API (Android Publisher) with managed OAuth authentication. Manage app listings, subscriptions, in-app purchases, reviews, and more.
Quick Start
# List in-app products
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/google-play/androidpublisher/v3/applications/{packageName}/inappproducts')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Base URL
https://gateway.maton.ai/google-play/{native-api-path}
Replace {native-api-path} with the actual Android Publisher API endpoint path. The gateway proxies requests to androidpublisher.googleapis.com and automatically injects your OAuth token.
Authentication
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Getting Your API Key
- Sign in or create an account at maton.ai
- Go to maton.ai/settings
- Copy your API key
Connection Management
Manage your Google OAuth connections at https://ctrl.maton.ai.
List Connections
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=google-play&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Create Connection
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'google-play'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"status": "ACTIVE",
"creation_time": "2025-12-08T07:20:53.488460Z",
"last_updated_time": "2026-01-31T20:03:32.593153Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "google-play",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
Delete Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Specifying Connection
If you have multiple Google Play connections, specify which one to use with the Maton-Connection header:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/google-play/androidpublisher/v3/applications/{packageName}/inappproducts')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
API Reference
In-App Products
List In-App Products
GET /google-play/androidpublisher/v3/applications/{packageName}/inappproducts
Get In-App Product
GET /google-play/androidpublisher/v3/applications/{packageName}/inappproducts/{sku}
Create In-App Product
POST /google-play/androidpublisher/v3/applications/{packageName}/inappproducts
Content-Type: application/json
{
"packageName": "com.example.app",
"sku": "premium_upgrade",
"status": "active",
"purchaseType": "managedUser",
"defaultPrice": {
"priceMicros": "990000",
"currency": "USD"
},
"listings": {
"en-US": {
"title": "Premium Upgrade",
"description": "Unlock all premium features"
}
}
}
Update In-App Product
PUT /google-play/androidpublisher/v3/applications/{packageName}/inappproducts/{sku}
Content-Type: application/json
{
"packageName": "com.example.app",
"sku": "premium_upgrade",
"status": "active",
"purchaseType": "managedUser",
"defaultPrice": {
"priceMicros": "1990000",
"currency": "USD"
}
}
Delete In-App Product
DELETE /google-play/androidpublisher/v3/applications/{packageName}/inappproducts/{sku}
Subscriptions
List Subscriptions
GET /google-play/androidpublisher/v3/applications/{packageName}/subscriptions
Get Subscription
GET /google-play/androidpublisher/v3/applications/{packageName}/subscriptions/{productId}
Create Subscription
POST /google-play/androidpublisher/v3/applications/{packageName}/subscriptions
Content-Type: application/json
{
"productId": "monthly_premium",
"basePlans": [
{
"basePlanId": "p1m",
"autoRenewingBasePlanType": {
"billingPeriodDuration": "P1M"
}
}
],
"listings": [
{
"languageCode": "en-US",
"title": "Premium Monthly"
}
]
}
Purchases
Get Purchase (one-time product)
GET /google-play/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}
Acknowledge Purchase
POST /google-play/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:acknowledge
Content-Type: application/json
{
"developerPayload": "optional payload"
}
Get Subscription Purchase
GET /google-play/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}
Cancel Subscription
POST /google-play/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:cancel
Refund Subscription
POST /google-play/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:refund
Reviews
List Reviews
GET /google-play/androidpublisher/v3/applications/{packageName}/reviews
Get Review
GET /google-play/androidpublisher/v3/applications/{packageName}/reviews/{reviewId}
Reply to Review
POST /google-play/androidpublisher/v3/applications/{packageName}/reviews/{reviewId}:reply
Content-Type: application/json
{
"replyText": "Thank you for your feedback!"
}
Edits (App Updates)
Create Edit
POST /google-play/androidpublisher/v3/applications/{packageName}/edits
Get Edit
GET /google-play/androidpublisher/v3/applications/{packageName}/edits/{editId}
Commit Edit
POST /google-play/androidpublisher/v3/applications/{packageName}/edits/{editId}:commit
Delete Edit
DELETE /google-play/androidpublisher/v3/applications/{packageName}/edits/{editId}
Code Examples
JavaScript
// List in-app products
const packageName = 'com.example.app';
const response = await fetch(
`https://gateway.maton.ai/google-play/androidpublisher/v3/applications/${packageName}/inappproducts`,
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const products = await response.json();
console.log(products);
Python
import os
import requests
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
package_name = 'com.example.app'
# List in-app products
response = requests.get(
f'https://gateway.maton.ai/google-play/androidpublisher/v3/applications/{package_name}/inappproducts',
headers=headers
)
products = response.json()
print(products)
Notes
- Replace
{packageName}with your app's package name (e.g.,com.example.app) - The Google Play Developer API requires the app to be published on Google Play
- Subscription management requires the app to have active subscriptions configured
- Edits are transactional - create an edit, make changes, then commit
- IMPORTANT: When using curl commands, use
curl -gwhen URLs contain brackets (fields[],sort[],records[]) to disable glob parsing - IMPORTANT: When piping curl output to
jqor other commands, environment variables like$MATON_API_KEYmay not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.
Error Handling
| Status | Meaning |
|---|---|
| 400 | Missing Google Play connection |
| 401 | Invalid or missing Maton API key |
| 404 | Package not found or no access |
| 429 | Rate limited (10 req/sec per account) |
| 4xx/5xx | Passthrough error from Google Play API |
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEYenvironment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
google-play. For example:
- Correct:
https://gateway.maton.ai/google-play/androidpublisher/v3/applications/{packageName}/inappproducts - Incorrect:
https://gateway.maton.ai/androidpublisher/v3/applications/{packageName}/inappproducts
Resources
-
08.14
如何撰写高效的营销策略报告?AI论文一键生成一份详尽的市场分析与总结范文供您参考!
-
08.14
Futuristic VTuber Debut Poster
-
08.14
AI面试助手如何提升企业招聘效率与质量
-
08.14
这是谐音梗手游好玩吗这是谐音梗手游核心玩法与趣味性解析
-
08.14
代号虐文大女主好玩吗代号虐文大女主手游剧情模式与大女主养成特色解析
-
08.14
纳米AI_PPT生成后如何编辑
-
- t3出行如何进行实名认证
- 07.30
-
- 原神5.8玛拉妮用什么武器好
- 07.30
-
-
- 斗罗大陆猎魂世界马红俊火队怎么搭配
- 07.30
-
- 《迷你世界》如何找到大海-找到大海的方法
- 07.30
-
- 热血江湖归来神武门拍照奇遇任务如何完成
- 07.30
-
-
下载
- |
-
-
下载
- 《行尸走肉第一章》免安装中文汉化硬盘版下载
- 单机|436 MB
- 一款以动作冒险为主题的游戏
-
-
下载
- 《街头霸王X铁拳》免安装中文汉化硬盘版下载
- 单机|111MB
- 一款非常好玩的格斗游戏
-
-
下载
- |
-
-
下载
- 《暗黑破坏神3》免安装繁体中文正式版下载
- 单机|7630 MB
- 一款以角色扮演为主题的游戏
-
-
下载
- 《马克思佩恩3》免安装硬盘版下载
- 单机|27033 MB
- 一款以第三人称射击为主题的游戏