Skip to content

Productivity

Google Sheets, Notion, Airtable, and Stripe integrations.

10 modules

ModuleDescription
Google 試算表讀取從 Google 試算表讀取資料
Google 試算表寫入寫入資料到 Google 試算表
Notion 建立頁面在 Notion 資料庫建立新頁面
Notion 查詢資料庫使用篩選和排序查詢 Notion 資料庫的頁面
Stripe 建立付款使用 Stripe 建立付款意圖
Stripe 取得客戶從 Stripe 取得客戶資訊
Stripe 列出收費列出 Stripe 的最近收費紀錄
Airtable 建立記錄在 Airtable 表格中建立新記錄
Airtable 讀取記錄從 Airtable 表格讀取記錄
Airtable 更新記錄更新 Airtable 表格中的現有記錄

Modules

Google 試算表讀取

api.google_sheets.read

從 Google 試算表讀取資料

Parameters:

NameTypeRequiredDefaultDescription
credentialsobjectNo-Google 服務帳戶 JSON 憑證(預設使用 env.GOOGLE_CREDENTIALS_JSON)
spreadsheet_idstringYes-Google 試算表 ID(來自網址)
rangestringYes-A1 標記法的範圍
include_headerbooleanNoTrue將第一列解析為欄位標題

Output:

FieldTypeDescription
valuesarray儲存格值
dataarray資料陣列
row_countnumber列數

Example: Read with headers

yaml
spreadsheet_id: 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
range: Sheet1!A1:D100
include_header: true

Google 試算表寫入

api.google_sheets.write

寫入資料到 Google 試算表

Parameters:

NameTypeRequiredDefaultDescription
credentialsobjectNo-Google 服務帳戶 JSON 憑證(預設使用 env.GOOGLE_CREDENTIALS_JSON)
spreadsheet_idstringYes-Google 試算表 ID(來自網址)
rangestringYes-A1 標記法的範圍
valuesarrayYes-要寫入的值陣列
value_input_optionstringNoUSER_ENTERED如何解譯輸入值

Output:

FieldTypeDescription
updated_rangestring更新的範圍
updated_rowsnumber更新的列數
updated_columnsnumber更新的欄數
updated_cellsnumber更新的儲存格數

Example: Write data with headers

yaml
spreadsheet_id: 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
range: Sheet1!A1
values: [["Name", "Email", "Status"], ["John Doe", "john@example.com", "Active"], ["Jane Smith", "jane@example.com", "Active"]]

Notion 建立頁面

api.notion.create_page

在 Notion 資料庫建立新頁面

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Notion 整合權杖(預設使用 env.NOTION_API_KEY)
database_idstringYes-Notion 資料庫 ID(32 字元十六進位字串)
propertiesobjectYes-頁面屬性(標題、文字、選項等)
contentarrayNo-頁面內容(Notion 區塊)

Output:

FieldTypeDescription
page_idstring頁面 ID
urlstring頁面網址
created_timestring建立時間

Example: Create task page

yaml
database_id: your_database_id
properties: {"Name": {"title": [{"text": {"content": "New Task"}}]}, "Status": {"select": {"name": "In Progress"}}, "Priority": {"select": {"name": "High"}}}

Notion 查詢資料庫

api.notion.query_database

使用篩選和排序查詢 Notion 資料庫的頁面

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Notion 整合權杖(預設使用 env.NOTION_API_KEY)
database_idstringYes-Notion 資料庫 ID
filterobjectNo-查詢的篩選條件
sortsarrayNo-結果的排序方式
page_sizenumberNo100回傳的結果數量

Output:

FieldTypeDescription
resultsarray頁面物件陣列
countnumber結果數量
has_moreboolean是否有更多結果

Example: Query all pages

yaml
database_id: your_database_id

Example: Query with filter

yaml
database_id: your_database_id
filter: {"property": "Status", "select": {"equals": "In Progress"}}
sorts: [{"property": "Created", "direction": "descending"}]

Stripe 建立付款

payment.stripe.create_payment

使用 Stripe 建立付款意圖

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)
amountnumberYes-Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)
currencystringNousd金額(分為單位,例如 1000 代表 $10.00)
descriptionstringNo-三碼幣別代碼(例如 usd、eur)
customerstringNo-付款說明

Output:

FieldTypeDescription
idstringStripe 客戶 ID(選填)
amountnumberStripe 客戶 ID(選填)
currencystring唯一識別碼
statusstring付款金額
client_secretstring幣別代碼

Example: Create $50 payment

yaml
amount: 5000
currency: usd
description: Product purchase

Example: Create payment for customer

yaml
amount: 2999
currency: usd
customer: cus_XXXXXXXXXXXXXXX
description: Subscription payment

Stripe 取得客戶

payment.stripe.get_customer

從 Stripe 取得客戶資訊

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)
customer_idstringYes-Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)

Output:

FieldTypeDescription
idstringUnique identifier
emailstringEmail address
namestringName of the item
creatednumberCreation timestamp
balancenumberAccount balance

Example: Get customer info

yaml
customer_id: cus_XXXXXXXXXXXXXXX

Stripe 列出收費

payment.stripe.list_charges

列出 Stripe 的最近收費紀錄

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)
limitnumberNo10Stripe 秘密金鑰(或使用 STRIPE_API_KEY 環境變數)
customerstringNo-依客戶 ID 篩選(選填)

Output:

FieldTypeDescription
chargesarrayThe charges
countnumberNumber of items
has_morebooleanThe has more

Example: List recent charges

yaml
limit: 20

Example: List customer charges

yaml
customer: cus_XXXXXXXXXXXXXXX
limit: 50

Airtable 建立記錄

productivity.airtable.create

在 Airtable 表格中建立新記錄

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
base_idstringYes-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
table_namestringYes-Airtable 基底 ID
fieldsjsonYes-表格名稱

Output:

FieldTypeDescription
idstringUnique identifier
createdTimestringRecord creation timestamp
fieldsjsonThe fields

Example: Create customer record

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Customers
fields: {"Name": "John Doe", "Email": "john@example.com", "Status": "Active"}

Example: Create task

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Tasks
fields: {"Title": "Review PR", "Assignee": "Alice", "Priority": "High"}

Airtable 讀取記錄

productivity.airtable.read

從 Airtable 表格讀取記錄

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
base_idstringYes-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
table_namestringYes-Airtable 基底 ID
viewstringNo-表格名稱
max_recordsnumberNo100要使用的檢視名稱(選填)

Output:

FieldTypeDescription
recordsarray回傳記錄的最大數量
countnumber記錄列表

Example: Read all customers

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Customers
max_records: 100

Example: Read from specific view

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Tasks
view: Active Tasks
max_records: 50

Airtable 更新記錄

productivity.airtable.update

更新 Airtable 表格中的現有記錄

Parameters:

NameTypeRequiredDefaultDescription
api_keystringNo-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
base_idstringYes-Airtable API 金鑰(或使用 AIRTABLE_API_KEY 環境變數)
table_namestringYes-Airtable 基底 ID
record_idstringYes-表格名稱
fieldsjsonYes-要更新的記錄 ID

Output:

FieldTypeDescription
idstringUnique identifier
fieldsjsonThe fields

Example: Update customer status

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Customers
record_id: recXXXXXXXXXXXXXX
fields: {"Status": "Inactive"}

Example: Update task

yaml
base_id: appXXXXXXXXXXXXXX
table_name: Tasks
record_id: recYYYYYYYYYYYYYY
fields: {"Status": "Completed", "Completed Date": "2024-01-15"}

Released under the Apache 2.0 License.