Zapier 集成

Zapier 集成

通过 Zapier 将 Working Timer 连接到数千种应用。例如,您可以根据日历事件、表单提交、电子表格行或已完成任务自动创建工作记录。

该集成使用 Working Timer 公共 API,您无需向 Zapier 提供 Working Timer 密码。

准备工作

  • 已启用 Public API 套餐或试用的 Working Timer 账户
  • 支持 API by ZapierWebhooks by Zapier 的付费 Zapier 套餐
  • 用于接收工作记录的 Working Timer 个人资料 ID

重要: 请像保护密码一样保护 API 密钥。不要将它放在可能出现在任务历史记录中的 Zap 名称、备注、URL 或其他字段中。

1. 创建 API 密钥

  1. 打开 Working Timer API 门户,选择 Sign In 并登录。
  2. API DashboardAPI Keys 部分选择 New Key
  3. 输入 Zapier 等易于识别的名称,然后选择 Create
  4. 立即复制以 wt_ak_ 开头的密钥。该密钥只显示一次。

如果密钥丢失,请将其撤销并创建新密钥。

2. 获取个人资料 ID

  1. 打开 API 参考文档
  2. 选择 Authorize,在 ApiKey 字段中输入密钥。
  3. 打开 GET /api/v1/Profile,依次选择 Try it outExecute
  4. 在响应中找到所需个人资料并复制其 id

该 ID 是类似 a1b2c3d4-1234-5678-9abc-1234567890ab 的 GUID。

3. 通过 API by Zapier 连接

  1. 在 Zapier 中打开 Apps,选择 Add connection,然后选择 API by Zapier
  2. Authentication type 中选择 Static Headers (API key)
  3. Headers 中添加一行:
X-Api-Key: wt_ak_your_api_key
  1. Connection name 设置为 Working Timer
  2. Domain filter 设置为 api.workingtimer.com
  3. Test URL 设置为 https://api.workingtimer.com/api/v1/Profile?pageSize=1
  4. 选择 Yes, Continue to API by Zapier

API by Zapier 目前是测试版功能。如果您的账户无法使用,请采用下方的 Webhooks 方法。

4. 创建第一个 Zap

  1. 创建 Zap 并选择触发器,例如新事件、任务、表单提交或电子表格行。
  2. 添加 API by Zapier,选择 API Request 操作和 Working Timer 连接。
  3. Method 设置为 POST,将 URL 设置为 https://api.workingtimer.com/api/v1/WorkRecord
  4. Body 中输入:
{
  "profileId": "YOUR_PROFILE_ID",
  "year": 2026,
  "month": 7,
  "day": 31,
  "clockIn": 540,
  "clockOut": 1020,
  "breakMinutes": 30,
  "recordType": "common",
  "isPaid": true,
  "note": "由 Zapier 创建"
}
  1. 替换 YOUR_PROFILE_ID,映射触发器中的值。如需转换格式,请先使用 Formatter by Zapier
  2. 选择 Test step。成功请求会返回状态 201。在 Working Timer 中确认记录后发布 Zap。

clockInclockOut 表示从午夜开始计算的分钟数:08:00 = 48009:00 = 54017:00 = 1020。夜班的 clockOut 可以大于 1440

备选方案:Webhooks by Zapier

添加 Webhooks by Zapier 并选择 POST 事件。将 URL 设置为 https://api.workingtimer.com/api/v1/WorkRecord,将 Payload Type 设置为 JSON,添加上述数据,并添加值为您的密钥的 X-Api-Key 标头和值为 application/jsonContent-Type 标头。成功测试会返回 201

其他常用请求

  • 获取个人资料:GET https://api.workingtimer.com/api/v1/Profile
  • 获取工作记录:GET https://api.workingtimer.com/api/v1/WorkRecord
  • 更新记录:PATCH https://api.workingtimer.com/api/v1/WorkRecord/{id}
  • 删除记录:DELETE https://api.workingtimer.com/api/v1/WorkRecord/{id}

其他 endpoint 请参阅 API 参考文档

故障排除

  • 401 Unauthorized — 密钥缺失、不完整或已撤销。标头名称必须准确写为 X-Api-Key
  • 403 Forbidden — 请启用或续订 Public API 套餐或试用。
  • 400 Bad Request — 检查 JSON、日期以及以数字表示的分钟值。
  • Profile was not found — 确认 profileId 属于同一 Working Timer 账户。
  • 429 Too Many Requests — 已达到 API 限额;请稍后重试并检查用量。
  • 重复记录 — 检查 Zapier 任务历史记录,并在 Working Timer 操作前使用筛选器或唯一来源 ID。

如需撤销访问权限,请在 API Dashboard 中对 Zapier 密钥选择 Revoke