frappe-impl-integrations
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "frappe-impl-integrations":https://skillpi.com/zh/skills/deepskill-33651bff876e67b841d027e851f34510b1ff16c01090f45c73562d84b9b69fab。安装前核对上游来源和版本:https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于在 Frappe 中实现 OAuth 提供商、Connected Apps、Webhooks、支付网关或数据导入/导出的集成场景,涵盖 OAuth2 提供方/客户端、Connected App 与 Webhook 文档类型、支付网关集成、数据导入/导出流程与 frappe.integrations 模块,旨在防止 OAuth 流程、Webhook 交付或批量导入时的常见故障。
介绍来源: third_party · Impertio-Studio · 2.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: frappe-impl-integrations
description: >
Use when implementing OAuth providers, Connected Apps, Webhooks, Payment Gateways, or Data Import/Export in Frappe.
Prevents authentication failures from wrong OAuth flow, missed webhook deliveries, and data corruption during bulk imports.
Covers OAuth2 provider/client, Connected App DocType, Webhook DocType, Payment Gateway integration, Data Import, Data Export, frappe.integrations module.
Keywords: OAuth, Connected App, Webhook, Payment Gateway, Data Import, Data Export, integration, API key, OAuth2, webhook trigger, connect to external service, OAuth setup, webhook configuration, import data, export data..
license: MIT
compatibility: "Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16."
metadata:
author: OpenAEC-Foundation
version: "2.0"Frappe Integrations
Step-by-step workflows for OAuth, Webhooks, Payment Gateways, Data Import/Export, and external API calls.
Version: v14/v15/v16
Decision Tree: Which Integration Pattern?
WHAT ARE YOU INTEGRATING?
│
├─► External service needs to call YOUR Frappe site?
│ ├─► On document events → Webhook (push to external)
│ ├─► External sends data to you → Whitelisted API endpoint
│ └─► External needs user auth → OAuth 2.0 Provider
│
├─► YOUR Frappe site calls an external service?
│ ├─► Needs user-level OAuth consent → Connected App
│ ├─► Server-to-server with API key → make_request / requests
│ └─► Recurring sync → Scheduler + API calls
│
├─► Bulk data in/out?
│ ├─► Import CSV/XLSX → Data Import DocType
│ ├─► Export data → Report Builder / export-csv / API
│ └─► Programmatic bulk → frappe.get_doc().insert()
│
├─► Payment processing?
│ └─► Payment Request + Payment Gateway controller
│
└─► Real-time vs batch?
├─► Real-time → Webhook or API endpoint
├─► Near real-time → frappe.enqueue() after event
└─► Batch → Scheduler task (hourly/daily)
Workflow 1: OAuth 2.0: Frappe as Provider
Use when external applications need "Sign in with Frappe" or API access on behalf of users.
Step 1: Configure OAuth Provider Settings
Navigate to Setup > Integrations > OAuth Provider Settings:
- Force: ALWAYS asks user for confirmation
- Auto: Asks only if no active token exists
Step 2: Create OAuth Client
Navigate to Setup > Integrations > OAuth Client:
| Field | Value |
|---|---|
| App Name | External app identifier |
| Scopes | Space-separated (e.g., openid all) |
| Redirect URIs | Space-separated callback URLs |
| Default Redirect URI | Primary callback URL |
| Grant Type | Authorization Code (RECOMMENDED) or Implicit |
| Response Type | Code (for Auth Code) or Token (for Implicit) |
| Skip Authorization | Check for trusted first-party apps only |
Step 3: Use the Generated Endpoints
| Endpoint | URL |
|---|---|
| Authorize | /api/method/frappe.integrations.oauth2.authorize |
| Token | /api/method/frappe.integrations.oauth2.get_token |
| Profile | /api/method/frappe.integrations.oauth2.openid_profile |
Step 4: Configure External App
# Example: Grafana generic_oauth config
client_id = <generated_client_id>
client_secret = <generated_client_secret>
auth_url = https://your-frappe.com/api/method/frappe.integrations.oauth2.authorize
token_url = https://your-frappe.com/api/method/frappe.integrations.oauth2.get_token
api_url = https://your-frappe.com/api/method/frappe.integrations.oauth2.openid_profile
scopes = openid all
Critical Rules
- NEVER use
Implicitgrant type for server-side apps — useAuthorization Code - ALWAYS use HTTPS in production for all OAuth endpoints
- NEVER expose
client_secretin client-side JavaScript
Workflow 2: Connected App: Frappe as OAuth Consumer
Use when your Frappe instance needs to access external services (Google, Microsoft, etc.) on behalf of users.
Step 1: Create Connected App DocType
| Field | Purpose |
|---|---|
| Name | Identifier for the connection |
| OpenID Configuration URL | Auto-fetches endpoints (e.g., /.well-known/openid-configuration) |
| Authorization URI | Consent screen URL (auto-filled from OpenID) |
| Token URI | Token exchange URL (auto-filled from OpenID) |
| Redirect URI | Auto-generated — copy this to external provider |
| Client ID | From external provider |
| Client Secret | From external provider |
| Scopes | Permissions needed (e.g., https://mail.google.com/) |
Step 2: Register Redirect URI with Provider
Copy the auto-generated Redirect URI and register it in the external provider's OAuth console.
Step 3: Add Extra Parameters (if needed)
access_type=offline # Google: enables refresh tokens
prompt=consent # Google: forces re-consent for refresh token
Step 4: Use in Code
import frappe
connected_app = frappe.get_doc("Connected App", "My Google App")
# Initiates OAuth flow — user clicks "Connect to..." button
# After consent, tokens are stored automatically
# Making authenticated calls:
session = connected_app.get_oauth2_session()
response = session.get("https://www.googleapis.com/gmail/v1/users/me/messages")
Critical Rules
- ALWAYS add
access_type=offlinefor Google APIs to get refresh tokens - NEVER store tokens manually — Connected App manages token lifecycle
- ALWAYS handle
TokenExpiredError— callsession.refresh_token()or reconnect
Workflow 3: Webhooks: Push Notifications to External Services
Step 1: Create Webhook DocType
Navigate to Integrations > Webhook:
| Field | Value |
|---|---|
| DocType | Target document type |
| Doc Event | on_update, after_insert, on_submit, on_cancel, on_trash |
| Request URL | External endpoint |
| Request Method | POST (default) |
| Conditions | Optional Jinja filter (e.g., doc.status == "Approved") |
| Enabled | Check to activate |
Step 2: Configure Headers
Add custom headers for authentication:
Authorization: Bearer <api_token>
Content-Type: application/json
Step 3: Configure Data: Choose Format
Form URL-encoded: Select specific fields from a table.
JSON: Use Jinja templates for structured payloads:
{
"id": "{{ doc.name }}",
"total": "{{ doc.grand_total }}",
"items": {{ doc.items | tojson }},
"event": "{{ event }}"
}
Step 4: Enable Webhook Secret (HMAC Verification)
Set a Webhook Secret — Frappe adds X-Frappe-Webhook-Signature header with base64-encoded HMAC-SHA256 hash of the payload.
Receiver verification (Python example):
import hmac, hashlib, base64
def verify_webhook(payload_body, secret, signature_header):
expected = base64.b64encode(
hmac.new(secret.encode(), payload_body, hashlib.sha256).digest()
).decode()
return hmac.compare_digest(expected, signature_header)
Critical Rules
- ALWAYS enable Webhook Secret for production webhooks
- NEVER rely on webhooks for guaranteed delivery — implement idempotency on the receiver
- ALWAYS use
| tojsonfilter for child table data in JSON payloads - Webhook logs are created for every delivery — check Webhook Request Log for debugging
Workflow 4: External API Calls from Frappe
Using frappe.integrations.utils
from frappe.integrations.utils import make_get_request, make_post_request
# GET request
response = make_get_request(
"https://api.example.com/data",
headers={"Authorization": "Bearer token123"}
)
# POST request
response = make_post_request(
"https://api.example.com/submit",
data={"key": "value"},
headers={"Content-Type": "application/json"}
)
Using requests Library Directly
import requests
import frappe
def sync_to_external():
try:
response = requests.post(
"https://api.example.com/endpoint",
json={"data": "value"},
timeout=30
)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
frappe.log_error(f"API call failed: {e}", "Integration Error")
raise
Critical Rules
- ALWAYS set a
timeouton external requests (30s recommended) - ALWAYS wrap external calls in try/except and log errors with
frappe.log_error() - NEVER call external APIs inside
validateorbefore_save— useon_update+frappe.enqueue() - ALWAYS use
frappe.enqueue()for slow external calls to avoid blocking the web request
Workflow 5: Data Import
Via UI (Data Import DocType)
- Navigate to Home > Data Import > New
- Select DocType and Import Type (
InsertorUpdate) - Download template CSV/XLSX
- Fill in data following the template format
- Upload and preview
- Start Import
CSV Format Rules
ID,Item Name,Item Group,Stock UOM
,Widget A,Products,Nos
,Widget B,Raw Material,Kg
- First row: field labels or API field names
- Leave
ID/nameempty for Insert (auto-generated) - For Update:
IDcolumn MUST contain existing document names - Child tables: repeat parent row data, add child fields as extra columns
Programmatic Import
import frappe
from frappe.core.doctype.data_import.data_import import DataImport
# Create Data Import document
di = frappe.get_doc({
"doctype": "Data Import",
"reference_doctype": "Item",
"import_type": "Insert New Records",
"import_file": "/path/to/file.csv"
})
di.insert()
di.start_import()
Critical Rules
- ALWAYS download and use the template — column order and names must match exactly
- NEVER import more than 5,000 rows at once — split into batches
- ALWAYS test with 5-10 rows first before bulk import
- ALWAYS check Import Log for row-level errors after import completes
Workflow 6: Data Export
Via Report Builder
- Open any DocType list view
- Apply filters
- Menu > Export (CSV/Excel)
Via CLI
bench --site mysite export-csv "Sales Invoice"
bench --site mysite export-doc "Sales Invoice" "INV-001"
bench --site mysite export-json "Sales Invoice" "INV-001"
bench --site mysite export-fixtures --app myapp
Programmatic Export
import frappe
# Export filtered data
data = frappe.get_all("Sales Invoice",
filters={"status": "Paid", "posting_date": [">", "2024-01-01"]},
fields=["name", "customer", "grand_total", "posting_date"],
order_by="posting_date desc",
limit_page_length=0 # No limit
)
# Convert to CSV
import csv, io
output = io.StringIO()
writer = csv.DictWriter(output, fieldnames=["name", "customer", "grand_total", "posting_date"])
writer.writeheader()
writer.writerows(data)
csv_content = output.getvalue()
Workflow 7: Frappe REST API Authentication
API Key + Secret (Server-to-Server)
# Generate via User > API Access > Generate Keys
curl -H "Authorization: token api_key:api_secret" \
https://your-site.com/api/resource/Sales%20Invoice
OAuth Bearer Token
curl -H "Authorization: Bearer access_token" \
https://your-site.com/api/resource/Sales%20Invoice
Session-Based (Login)
# Login first
curl -X POST https://your-site.com/api/method/login \
-d "usr=user@example.com&pwd=password"
# Subsequent requests use session cookie
Integration Patterns: Sync vs Async
| Pattern | When to Use | Implementation |
|---|---|---|
| Synchronous | Response needed immediately | Direct API call in controller |
| Async (enqueue) | External call > 5s | frappe.enqueue("myapp.api.sync_record", doc_name=doc.name) |
| Webhook | Push on event | Webhook DocType configuration |
| Scheduled sync | Periodic batch | scheduler_events in hooks.py |
| Real-time | Live updates | Socket.IO + frappe.publish_realtime() |
Retry Pattern
import frappe
from frappe.utils.background_jobs import get_jobs
def sync_with_retry(doc_name, retry_count=0, max_retries=3):
try:
result = call_external_api(doc_name)
frappe.db.set_value("Sales Invoice", doc_name, "sync_status", "Success")
frappe.db.commit()
except Exception as e:
if retry_count < max_retries:
frappe.enqueue(
"myapp.integrations.sync_with_retry",
doc_name=doc_name,
retry_count=retry_count + 1,
queue="short",
enqueue_after_commit=True
)
else:
frappe.log_error(f"Sync failed after {max_retries} retries: {e}")
frappe.db.set_value("Sales Invoice", doc_name, "sync_status", "Failed")
frappe.db.commit()
Version Differences
| Feature | V14 | V15 | V16 |
|---|---|---|---|
| Webhook DocType | Yes | Yes | Yes |
| Connected App | Yes | Yes | Yes |
| OAuth 2.0 Provider | Yes | Yes | Yes |
| Data Import (new UI) | Yes | Yes | Yes |
| Print Designer | No | Yes | Yes |
make_get_request |
Yes | Yes | Yes |
| Webhook HMAC | Yes | Yes | Yes |
Reference Files
| File | Contents |
|---|---|
| workflows.md | Complete integration workflow patterns |
| examples.md | Working code examples for all integration types |
| anti-patterns.md | Common integration mistakes and fixes |
| decision-tree.md | Extended decision trees for integration choice |
版本历史
-
v3.1.1
GitHub ↗
原版更新说明
## What's new Expanded Keywords in all skill descriptions with user-friendly, non-technical discovery terms. Skills are now easier to find when users describe problems in plain language instead of technical terminology. Examples of added terms: - Symptom-based: "app is slow", "nothing shows", "container won't start" - Beginner-friendly: "how do I start", "what is", "getting started" - Error messages: literal error text users would paste - Alternative names: common synonyms and abbreviations No skill content was changed. Only the Keywords line in SKILL.md frontmatter was expanded.
-
v3.1.0
GitHub ↗
原版更新说明
## What's new - package.json with agents.skills[] manifest for external discovery (60 skills) - agents/openai.yaml for OpenAI Codex - GitHub topic agentskills added - SKILLS_LOG.md added to .gitignore - Em-dashes replaced with colons in 31 SKILL.md section headings Enables discovery via npx skills add, skills.sh, LobeHub, and other platforms.
-
v3.0.0
GitHub ↗
原版更新说明
## Summary - **60 deterministic skills** for Frappe Framework v14-v16 (up from 53 in v2.0) - **~95% surface area coverage** (up from ~85%) - 7 new skills + 12 existing skills extended with new reference files ## New Skills (7) | Skill | Category | Coverage | |-------|----------|----------| | `frappe-core-translation` | core | i18n, _(), __(), CSV/PO files, string extraction | | `frappe-core-utils` | core | 140+ date, number, string, validation functions | | `frappe-syntax-print` | syntax | Print formats, PDF generation, Letter Head | | `frappe-syntax-query-builder` | syntax | frappe.qb, joins, aggregation, cross-DB | | `frappe-impl-workspace` | impl | Workspace builder, number cards, charts | | `frappe-core-logging` | core | frappe.logger(), Error Log, Sentry integration | | `frappe-core-search` | core | Link search, global search, SQLiteSearch FTS5 | ## Extended Skills (12) 13 new reference files added to existing skills covering: Controls API, Tree View, Portal Generators, Print Format decision tree, Email system, Module/Workspace shipping, complete Document API, custom bench commands, request lifecycle, advanced debugging (VS Code DAP), Frappe Packages, data masking (v16+), and Python type stubs. ## Stats | Category | Count | |----------|:-----:| | syntax/ | 13 | | core/ | 11 | | impl/ | 14 | | errors/ | 7 | | ops/ | 8 | | agents/ | 5 | | testing/ | 2 | | **Total** | **60** | ## Install ```bash git clone https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package.git cp -r Frappe_Claude_Skill_Package/skills/source/* ~/.claude/skills/ ```
-
v2.0.0
GitHub ↗
原版更新说明
## Frappe Claude Skill Package v2.0.0 Massive upgrade from 28 ERPNext-specific skills to **53 Frappe Framework skills** covering ~85% of the Frappe surface area. ### What's New - **25 new skills** across 3 new categories (ops, testing, agents) - **28 existing skills** fully rewritten with fresh research - **Renamed** from `erpnext-*` to `frappe-*` (all skills are Frappe Framework, not ERPNext-specific) - **7 categories**: syntax (11), core (7), impl (13), errors (7), ops (8), agents (5), testing (2) ### New Categories - **ops/** — Bench CLI, deployment, backup, performance, upgrades, frontend build, cloud - **testing/** — Unit/integration tests, CI/CD with GitHub Actions - **3 new agents** — debugger, migrator, architect ### Key Improvements - All skills verified against official Frappe docs (March 2026) - v16 features documented: `extend_doctype_class`, data masking, type annotations - MIT license (was LGPL-3.0) - Deterministic language throughout (ALWAYS/NEVER) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
-
v1.1.0
GitHub ↗
原版更新说明
V16 compatibility update and documentation improvements. ## Added - USAGE.md with platform-specific guides (Claude.ai, Claude Code, API) - Complete README overhaul with quick start guide ## Changed - All 28 skills updated for ERPNext/Frappe V16 compatibility - Agent Skills now follow standard skill structure - Improved validation: 28/28 skills pass all checks ## Fixed - V16-specific syntax changes in 9 skills - Agent SKILL.md files now under 500 lines
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
2.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的 Frappe 集成开发工作流,涵盖 OAuth、Webhook、支付网关等核心场景
- 包含详细的配置步骤、代码示例和关键安全规则
- 面向开发者解决实际集成痛点,具有高度实用价值
亮点
- 触发词精准完整,覆盖多种集成场景变体
- 关键词列表详尽,边界清晰,便于用户准确触发
待提升项
-
缺少 When to Use 显式章节标题 原报告严重程度:轻微
文档内容完整但未使用标准 When to Use 章节标题
改进建议:建议添加显式的 When to Use 章节以提升规范性
亮点
- Phase/步骤清晰,每个工作流分步说明
- 包含端到端示例和关键规则
- frontmatter 完整,文档结构良好
待提升项
-
部分代码示例缺少完整错误处理上下文 原报告严重程度:轻微
部分代码片段缺少完整的异常处理上下文说明
改进建议:建议在关键代码示例中添加更完整的错误处理说明
亮点
- 工具来源明确,参数说明详细
- 覆盖主要异常处理建议
- 不可逆操作有确认机制提示
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 4, 5, 7, 17, 31 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- api.example.com
- mail.google.com
- www.googleapis.com
- your-frappe.com
- your-site.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。