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

一站式新闻通讯API网关

beehiiv · vv1.0.0
内容创作 安全 A 级 作者 byungkyu 公开目录收录
3.4k 下载 717 安装 16.3k 收藏 21.5k 浏览

简介

Maton官方提供的beehiiv API网关集成方案,通过托管OAuth实现新闻通讯订阅管理、文章发布与自动化运营,降低开发者对接门槛。

原始描述

beehiiv API integration with managed OAuth. Manage newsletter publications, subscriptions, posts, custom fields, segments, and automations. Use this skill when users want to manage newsletter subscribers, create posts, organize segments, or integrate with beehiiv publications. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.

通过你的 Agent 添加

安装目录:beehiiv/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/beehiiv-561/
Codex CLI~/.codex/skills/beehiiv-561/
DeepSeek Harness~/.agents/skills/beehiiv-561/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

beehiiv skill 是 Maton 平台提供的 beehiiv 新闻通讯服务 API 网关集成方案。用户通过获取 Maton API 密钥(MATON_API_KEY),即可调用封装后的 beehiiv 原生 API,无需自行处理复杂的 OAuth 认证流程。所有请求经由 https://gateway.maton.ai/beehiiv// 代理转发,自动注入用户授权的 OAuth Token。

该 skill 覆盖 beehiiv 核心功能模块:出版物(Publications)管理、订阅者(Subscriptions)增删改查、文章(Posts)发布与删除、自定义字段(Custom Fields)配置、用户分群(Segments)管理、付费层级(Tiers)设置以及自动化(Automations)规则访问。支持游标分页(推荐)和传统页码分页两种数据获取方式。

使用前需在 ctrl.maton.ai 控制面板创建 beehiiv OAuth 连接,完成授权后获取连接 ID。多连接场景下可通过 Maton-Connection 请求头指定特定连接,否则默认使用最早创建的活跃连接。

显著优点

  1. 认证简化:将 beehiiv 原生 OAuth 2.0 流程抽象为托管模式,开发者只需管理单一 Maton API 密钥,大幅降低集成复杂度。

  2. 功能完整:覆盖 beehiiv v2 API 全量核心能力,从基础订阅管理到高级自动化、推荐计划均可调用。

  3. 多语言友好:提供 Python、JavaScript、Bash/curl 等完整代码示例,降低多技术栈团队接入成本。

  4. 连接灵活:支持多账号管理,同一 Maton 账户可维护多个 beehiiv 出版物的独立授权连接。

  5. 分页优化:推荐使用游标分页,避免传统页码在大量数据场景下的性能瓶颈和 100 页限制。

潜在缺点与局限性

  1. 供应商锁定:完全依赖 Maton 网关服务,若 Maton 平台出现服务中断或商业策略调整,将直接影响 API 可用性。

  2. 功能延迟:作为封装层,新发布的 beehiiv API 功能可能存在对接延迟,需等待 Maton 网关更新。

  3. 调试透明度:错误排查需经过 Maton 网关层,相比直连 beehiiv API,问题定位链条更长。

  4. 地理合规:订阅者数据流经 Maton 美国服务器(maton.ai),对 GDPR、中国数据出境等合规场景需额外评估。

  5. 成本不透明:文档未明确 Maton 网关的定价模式,可能存在隐性调用成本或速率限制。

适合的目标群体

  • 独立创作者与 newsletter 运营者:希望自动化订阅管理、批量导入用户、搭建付费墙的技术型内容创业者。
  • SaaS 产品团队:需要将邮件通讯功能集成至自有产品,但不愿投入资源自建邮件基础设施的中小团队。
  • 营销自动化工程师:负责跨平台用户数据同步、生命周期营销流程搭建的技术运营人员。
  • ** agencies 与代运营服务商**:同时管理多个客户 beehiiv 账号,需要统一 API 入口提升效率的服务商。

使用风险

  1. 密钥泄露风险:MATON_API_KEY 一旦泄露,攻击者可访问所有关联的 beehiiv 连接。建议配合密钥管理服务(如 AWS Secrets Manager、Doppler)使用,避免硬编码。

  2. 速率限制:beehiiv 与 Maton 网关均可能实施速率限制,高频调用场景(如全量订阅者同步)需实现指数退避重试机制。

  3. 数据一致性:网络超时或网关故障可能导致操作状态不确定,关键操作(如付费订阅变更)建议配合幂等性设计与状态校验。

  4. OAuth 令牌过期:长期运行的自动化流程需监控连接状态,通过 ctrl.maton.ai 接口或邮件告警及时处理授权失效。

技能正文


name: beehiiv description: | beehiiv API integration with managed OAuth. Manage newsletter publications, subscriptions, posts, custom fields, segments, and automations. Use this skill when users want to manage newsletter subscribers, create posts, organize segments, or integrate with beehiiv publications. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key. metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 requires: env: - MATON_API_KEY

beehiiv

Access the beehiiv API with managed OAuth authentication. Manage newsletter publications, subscriptions, posts, custom fields, segments, tiers, and automations.

Quick Start

# List publications
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/beehiiv/v2/publications')
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/beehiiv/{native-api-path}

Replace {native-api-path} with the actual beehiiv API endpoint path. The gateway proxies requests to api.beehiiv.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

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your beehiiv 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=beehiiv&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': 'beehiiv'}).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": "8bfe17f4-0038-4cbd-afb4-907b1ffa9d66",
    "status": "ACTIVE",
    "creation_time": "2026-02-11T00:25:10.464852Z",
    "last_updated_time": "2026-02-11T00:27:00.816431Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "beehiiv",
    "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 beehiiv 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/beehiiv/v2/publications')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '8bfe17f4-0038-4cbd-afb4-907b1ffa9d66')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If omitted, the gateway uses the default (oldest) active connection.

API Reference

All beehiiv API endpoints follow this pattern:

/beehiiv/v2/{resource}

Publications

List Publications

GET /beehiiv/v2/publications

Query Parameters:

Parameter Description
limit Results per page (1-100, default: 10)
page Page number (default: 1)
expand[] Expand with: stats, stat_active_subscriptions, stat_average_open_rate, etc.
order_by Sort by: created or name
direction Sort direction: asc or desc

Response:

{
  "data": [
    {
      "id": "pub_c6c521e4-91ac-4c14-8a52-06987b7e32f2",
      "name": "My Newsletter",
      "organization_name": "My Organization",
      "referral_program_enabled": true,
      "created": 1770767522
    }
  ],
  "page": 1,
  "limit": 10,
  "total_results": 1,
  "total_pages": 1
}

Get Publication

GET /beehiiv/v2/publications/{publication_id}

Subscriptions

List Subscriptions

GET /beehiiv/v2/publications/{publication_id}/subscriptions

Query Parameters:

Parameter Description
limit Results per page (1-100, default: 10)
cursor Cursor for pagination (recommended)
page Page number (deprecated, max 100 pages)
email Filter by exact email (case-insensitive)
status Filter: validating, invalid, pending, active, inactive, all
tier Filter: free, premium, all
expand[] Expand with: stats, custom_fields, referrals
order_by Sort field (default: created)
direction Sort direction: asc or desc

Response:

{
  "data": [
    {
      "id": "sub_c27d9640-f418-43a8-a0f9-528c20a05002",
      "email": "subscriber@example.com",
      "status": "active",
      "created": 1770767524,
      "subscription_tier": "free",
      "subscription_premium_tier_names": [],
      "utm_source": "direct",
      "utm_medium": "",
      "utm_channel": "website",
      "utm_campaign": "",
      "referring_site": "",
      "referral_code": "gBZbSVal1X",
      "stripe_customer_id": ""
    }
  ],
  "limit": 10,
  "has_more": false,
  "next_cursor": null
}

Get Subscription by ID

GET /beehiiv/v2/publications/{publication_id}/subscriptions/{subscription_id}

Query Parameters:

Parameter Description
expand[] Expand with: stats, custom_fields, referrals, tags

Get Subscription by Email

GET /beehiiv/v2/publications/{publication_id}/subscriptions/by_email/{email}

Create Subscription

POST /beehiiv/v2/publications/{publication_id}/subscriptions
Content-Type: application/json

{
  "email": "newsubscriber@example.com",
  "utm_source": "api",
  "send_welcome_email": false,
  "reactivate_existing": false
}

Request Body:

Field Type Required Description
email string Yes Subscriber email address
reactivate_existing boolean No Reactivate if previously unsubscribed
send_welcome_email boolean No Send welcome email
utm_source string No UTM source for tracking
utm_medium string No UTM medium
referring_site string No Referral code of referring subscriber
custom_fields object No Custom field values (fields must exist)
double_opt_override string No on or off to override double opt-in
tier string No Subscription tier
premium_tier_names array No Premium tier names to assign

Update Subscription

PATCH /beehiiv/v2/publications/{publication_id}/subscriptions/{subscription_id}
Content-Type: application/json

{
  "utm_source": "updated-source",
  "custom_fields": [
    {"name": "First Name", "value": "John"}
  ]
}

Delete Subscription

DELETE /beehiiv/v2/publications/{publication_id}/subscriptions/{subscription_id}

Posts

List Posts

GET /beehiiv/v2/publications/{publication_id}/posts

Query Parameters:

Parameter Description
limit Results per page (1-100, default: 10)
page Page number
status Filter by status
expand[] Expand with additional data

Response:

{
  "data": [],
  "page": 1,
  "limit": 10,
  "total_results": 0,
  "total_pages": 0
}

Get Post

GET /beehiiv/v2/publications/{publication_id}/posts/{post_id}

Delete Post

DELETE /beehiiv/v2/publications/{publication_id}/posts/{post_id}

Custom Fields

List Custom Fields

GET /beehiiv/v2/publications/{publication_id}/custom_fields

Response:

{
  "data": [
    {
      "id": "95c9653f-a1cf-45f0-a140-97feef19057b",
      "kind": "string",
      "display": "Last Name",
      "created": 1770767523
    },
    {
      "id": "4cfe081e-c89b-4da5-9c1a-52a4fb8ba69e",
      "kind": "string",
      "display": "First Name",
      "created": 1770767523
    }
  ],
  "page": 1,
  "limit": 10,
  "total_results": 2,
  "total_pages": 1
}

Field Kinds: string, integer, boolean, date, datetime, list, double

Create Custom Field

POST /beehiiv/v2/publications/{publication_id}/custom_fields
Content-Type: application/json

{
  "display": "Company",
  "kind": "string"
}

Update Custom Field

PATCH /beehiiv/v2/publications/{publication_id}/custom_fields/{custom_field_id}
Content-Type: application/json

{
  "display": "Company Name"
}

Delete Custom Field

DELETE /beehiiv/v2/publications/{publication_id}/custom_fields/{custom_field_id}

Segments

List Segments

GET /beehiiv/v2/publications/{publication_id}/segments

Response:

{
  "data": [],
  "page": 1,
  "limit": 10,
  "total_results": 0,
  "total_pages": 0
}

Get Segment

GET /beehiiv/v2/publications/{publication_id}/segments/{segment_id}

Delete Segment

DELETE /beehiiv/v2/publications/{publication_id}/segments/{segment_id}

Tiers

List Tiers

GET /beehiiv/v2/publications/{publication_id}/tiers

Get Tier

GET /beehiiv/v2/publications/{publication_id}/tiers/{tier_id}

Create Tier

POST /beehiiv/v2/publications/{publication_id}/tiers
Content-Type: application/json

{
  "name": "Premium",
  "description": "Premium tier with exclusive content"
}

Update Tier

PATCH /beehiiv/v2/publications/{publication_id}/tiers/{tier_id}
Content-Type: application/json

{
  "name": "Updated Tier Name"
}

Automations

List Automations

GET /beehiiv/v2/publications/{publication_id}/automations

Get Automation

GET /beehiiv/v2/publications/{publication_id}/automations/{automation_id}

Referral Program

Get Referral Program

GET /beehiiv/v2/publications/{publication_id}/referral_program

Pagination

beehiiv supports two pagination methods:

Cursor-Based (Recommended)

GET /beehiiv/v2/publications/{publication_id}/subscriptions?limit=10&cursor={next_cursor}

Response includes:

{
  "data": [...],
  "limit": 10,
  "has_more": true,
  "next_cursor": "eyJ0aW1lc3RhbXAiOiIyMDI0LTA3LTAyVDE3OjMwOjAwLjAwMDAwMFoifQ=="
}

Use the next_cursor value for subsequent requests.

Page-Based (Deprecated)

GET /beehiiv/v2/publications?page=2&limit=10

Response includes:

{
  "data": [...],
  "page": 2,
  "limit": 10,
  "total_results": 50,
  "total_pages": 5
}

Note: Page-based pagination is limited to 100 pages maximum.

Code Examples

JavaScript

const response = await fetch(
  'https://gateway.maton.ai/beehiiv/v2/publications',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const data = await response.json();
console.log(data.data);

Python

import os
import requests

response = requests.get(
    'https://gateway.maton.ai/beehiiv/v2/publications',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
for pub in data['data']:
    print(f"{pub['id']}: {pub['name']}")

Notes

  • Publication IDs start with pub_
  • Subscription IDs start with sub_
  • Timestamps are Unix timestamps (seconds since epoch)
  • Custom fields must be created before use in subscriptions
  • Cursor-based pagination is recommended for better performance
  • Page-based pagination is deprecated and limited to 100 pages
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments

Error Handling

Status Meaning
400 Bad request or invalid parameters
401 Invalid or missing Maton API key
403 Forbidden - insufficient permissions or plan limitation
404 Resource not found
429 Rate limited
500 Internal server error

Troubleshooting: API Key Issues

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. 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

  1. Ensure your URL path starts with beehiiv. For example:
  • Correct: https://gateway.maton.ai/beehiiv/v2/publications
  • Incorrect: https://gateway.maton.ai/v2/publications

Resources

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

标签

apicontent-mediamarketingautomationcustomer-supportproductivity

同类 Skill