微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🏗️

施工管理平台的自动化中枢

jobtread-api · vv1.0.0
专业技能 安全 S+ 级 作者 Brokenwatch24 公开目录收录
下载 2k 安装 520 收藏 8k 浏览 11.5k
原始页面

简介

基于 JobTread 官方 Pave API 的文档型技能,支持施工管理平台的客户、工单、文档等全流程自动化操作,需用户自行管理 API 密钥。

原始描述

Operate JobTread via its Pave API to create, read, update, and manage accounts, jobs, documents, tasks, locations, custom fields, and webhooks programmatically.

中文使用说明 来自收录源

核心用法

JobTread via Pave Query API 是一个纯文档型技能,指导用户通过 OpenClaw 与 JobTread 施工管理平台进行交互。所有操作均通过向 https://api.jobtread.com/pave 发送 POST 请求完成,采用 GraphQL 风格的查询结构。用户需先在 JobTread 后台创建 grant 获取 grantKey,然后在每个请求的 query.$ 对象中嵌入该密钥完成认证。

该技能覆盖了完整的业务场景:创建和管理客户/供应商账户、工单全生命周期管理、文档生成与 PDF 下载、地理位置信息维护、自定义字段读写、以及 webhook 订阅实现实时通知。查询支持分页、排序、过滤(包括嵌套字段和自定义字段),并可通过聚合函数进行数据统计。

显著优点

架构清晰灵活:Pave API 的查询语法高度一致,学习成本低,同一套模式可复用于读、写、过滤、聚合等多种操作。字段按需返回的设计减少了网络传输开销。

功能覆盖全面:从基础的 CRUD 到高级场景如预签名 PDF 链接、webhook 事件订阅、自定义字段过滤等均有详细示例,满足施工管理业务的复杂需求。

安全实践指导完善:文档明确建议密钥存储路径(~/.config/jobtread/grant_key)、文件权限(600)、轮换周期(3 个月),并强调 HTTPS 强制加密。

自动化友好:提供了可直接复用的 YAML/JSON 查询模板,以及夜间汇总、批量导入、文档监控等实际自动化场景思路,降低落地门槛。

潜在缺点与局限性

认证管理负担重:Grant key 3 个月过期机制要求用户建立主动维护流程,对于无人值守的长期自动化任务存在中断风险。

无 SDK 封装:纯 HTTP 接口调用,开发者需自行处理错误重试、速率限制、分页逻辑等基础设施,生产环境需要额外封装层。

查询复杂度随业务增长:深层嵌套过滤、多条件组合查询的 YAML 结构会变得冗长,可读性下降,调试成本增加。

平台锁定:深度绑定 JobTread 的数据模型和 Pave 查询语法,迁移至其他施工管理平台需完全重写集成逻辑。

适合的目标群体

  • 施工管理、装修工程行业的技术负责人,需要将 JobTread 数据与内部系统打通
  • 小型开发团队为客户定制 JobTread 自动化工作流
  • 已使用 OpenClaw 生态、希望统一 AI 助手操作界面的效率用户
  • 具备基础 API 调用能力、能独立管理密钥生命周期的技术人员

使用风险

密钥泄露风险:虽然文档建议了安全存储方式,但实际执行依赖用户自律。一旦 grantKey 泄露,攻击者可访问该组织全部 JobTread 数据。

速率限制与稳定性:生产自动化需自行实现退避重试机制,高频查询可能触发平台限流导致任务失败。

数据一致性:Webhook 投递存在延迟或丢失可能,关键业务逻辑不应仅依赖事件驱动,需配合定期轮询校验。

长期维护成本:JobTread API 版本迭代可能导致查询语法变更,需持续关注官方文档更新。

技能正文

Skill: JobTread via Pave Query API

Summary

This skill lets you operate JobTread entirely through openclaw using the Pave-based API at https://api.jobtread.com/pave. Every request is a single POST with a query object that mirrors GraphQL-style expressions, and you decide which fields you want back. With the right grant key, you can create and manage accounts (customers/vendors), jobs, documents, tasks, locations, custom fields, documents, and even subscribe to webhooks for live updates.

Setup & Credentials

  1. Create a grant: Login to https://app.jobtread.com/grants and create a new grant for automation. Copy the one-time grantKey (it begins with grant_ and will only show once).
  2. Store the key locally: Use a secure file such as ~/.config/jobtread/grant_key. Example:
    mkdir -p ~/.config/jobtread
    echo "grant_xxx" > ~/.config/jobtread/grant_key
    chmod 600 ~/.config/jobtread/grant_key
    
  3. Keep it fresh: JobTread expires keys after 3 months of inactivity, so schedule a reminder (cron/heartbeat) to rotate or re-use the grant before expiration.
  4. Optional webhook secret: If you plan to receive webhooks, note your endpoint URL and save the webhook ID in the same folder so you can disable or inspect it later.

Authentication

  • Every POST to /pave must include the grant key under query.$.grantKey. Example payload:
    {
      "query": {
        "$": { "grantKey": "grant_xxx" },
        "currentGrant": { "id": {}, "user": { "name": {} } }
      }
    }
    
  • You can also set notify, timeZone, or viaUserId inside $ when you need to suppress notifications or scope results.
  • For signed queries (PDF tokens, pre-signed data), call pdfToken: { _: signQuery, $: { query: {...} } } and append the token to https://api.jobtread.com/t/.

API Basics & Request Flow

  • All requests go to POST https://api.jobtread.com/pave with Content-Type: application/json.
  • Structure:
    {
      "query": {
        "$": { "grantKey": "grant_xxx" },  
        "operation": {
          "$": { ...inputs... },
          "field": { ...fields... }
        }
      }
    }
    
  • Fields you request (id, name, etc.) determine what JobTread returns. Always include id when you plan to reference the object later.
  • _type in responses tells you the schema for that node.

Common Patterns & Examples

1. Discover your organization ID

currentGrant:
  user:
    memberships:
      nodes:
        organization:
          id: {}
          name: {}

Use the returned organization.id in any following query.

2. Create customers/vendors

  • Customer
createAccount:
  $:
    name: "Test Customer"
    type: customer
    organizationId: "ORG_ID"
  createdAccount:
    id: {}
    name: {}
    type: {}
  • Vendor (same as above but type: vendor).

3. Read or update accounts

  • Read account by supplying id and requesting fields:
account:
  $:
    id: "ACCOUNT_ID"
  id: {}
  name: {}
  isTaxable: {}
  • Update and include customFieldValues if needed:
updateAccount:
  $:
    id: "ACCOUNT_ID"
    isTaxable: false
  account:
    id: {}
    isTaxable: {}

4. Query accounts list with pagination, sorting, and filters

organization:
  $: {}
  id: {}
  accounts:
    $:
      size: 5
      page: "1"
      sortBy:
        - field: type
          order: desc
      where:
        and:
          - - type
            - =
            - customer
          - - name
            - =
            - "Sebas Clients"
    nextPage: {}
    nodes:
      id: {}
      name: {}
      type: {}

5. Use where with or, nested fields, or custom fields

  • Find account by custom field name:
organization:
  $: {}
  id: {}
  contacts:
    $:
      with:
        cf:
          _: customFieldValues
          $:
            where:
              - - customField
                - name
              - "VIP"
            values:
              $:
                field: value
      where:
        - - cf
          - values
        - =
        - "Yes"
    nodes:
      id: {}
      name: {}

6. Locations and nested filters

Create location and find others tied to the same account:

createLocation:
  $:
    accountId: "ACCOUNT_ID"
    name: Test Location
    address: "123 Main St"
  createdLocation:
    id: {}
    name: {}

organization:
  $: {}
  id: {}
  locations:
    $:
      where:
        - - account
          - name
        - Test Name
    nodes:
      id: {}
      name: {}
      account:
        id: {}
        name: {}

7. Documents, jobs, and aggregates

  • Get a job's documents grouped by type/status and sums:
job:
  $:
    id: "JOB_ID"
  documents:
    $:
      where:
        - - type
          - in
          - - customerInvoice
            - customerOrder
      group:
        by:
          - type
          - status
        aggs:
          amountPaid:
            sum: amountPaid
          priceWithTax:
            sum: priceWithTax
    withValues: {}
  • Get document PDF token (append to https://api.jobtread.com/t/{{token}}):
pdfToken:
  _: signQuery
  $:
    query:
      pdf:
        $:
          id: "DOCUMENT_ID"

8. Custom fields

  • Read a record's custom field values (limit 25 per request):
account:
  $:
    id: "ACCOUNT_ID"
  customFieldValues:
    $:
      size: 25
    nodes:
      id: {}
      value: {}
      customField:
        id: {}
  • Update a custom field via customFieldValues map:
updateAccount:
  $:
    id: "ACCOUNT_ID"
    customFieldValues:
      "CUSTOM_FIELD_ID": "New value"
  account:
    id: {}

9. Webhooks

  • Use the JobTread UI to create a webhook (Webhooks page) and copy its ID.
  • Manage them via the API: list webhook(id: "ID") or deleteWebhook to cancel.
  • Example create query:
createWebhook:
  $:
    organizationId: "ORG_ID"
    url: "https://your-endpoint/hooks/jobtread"
    eventTypes:
      - jobCreated
      - documentUploaded
  createdWebhook:
    id: {}
    url: {}

Using This Skill with OpenClaw

  • Use curl or your preferred HTTP client from OpenClaw's exec tool.
  • Build the JSON payload as shown (always include the grant key inside $).
  • You can also wrap the payload in shell variables or helper scripts for portability.
  • Save reusable queries in the skill file or separate scripts so Claude or you can call them by name ("run job summary", "create customer", etc.).
  • Document each automation in the JobTread vault so you can copy/paste from future sessions without digging through logs.

Automation Ideas

  1. Nightly job summary: Query each open job, sum approved customer orders, and store results in Obsidian (or send via WhatsApp).
  2. Webhook monitor: Automatically spin up a webhook for file uploads and forward notifications to your Slack/WhatsApp via a small server.
  3. Batch account creation: Feed a CSV of customers/vendors and run createAccount for each with the same grant key.
  4. Document check-ins: Query documents with status: pending and send you a summary each morning.

Troubleshooting & Tips

  • Rate limits: Grant keys have a throughput cap. If you hit rate limits, add time.sleep between requests or batch fewer objects.
  • Missing IDs: The API complains id field required when you forget to request id. Always include it when you plan to mutate the record later.
  • Grant expiration: If a request returns invalid key, rotate the grant and update ~/.config/jobtread/grant_key.
  • Webhooks: Keep a log of webhook IDs so you can disable or reconfigure them later.
  • Signed tokens: Use signQuery when you need temporary access to document PDFs without storing raw document IDs.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

apiproductivityautomationproject-program-managementoperationsbackenddocs

同类 Skill