面向以下情境的評論 API: 即時討論

透過一套 REST API 與 10+ 種語言的 SDK 實現評論、審核與社交動態流。從你的後端擷取、發布與審核內容,再透過 WebSockets 將新動態即時推送給每一位讀者。

一個平台,三套 API

FastComments 不僅僅是評論。在同一套 API 與 SDK 上建構討論、審核與社交動態流。

評論 API

支援巢狀評論與即時聊天。內建 SSO 與即時更新,可擷取、發布、投票、置頂、回覆與搜尋。

審核 API

擁有 40+ 端點的專用審核介面。支援核准、標記、封鎖、停權、鎖定與稽核,並由自動垃圾訊息過濾提供支撐。

社交動態流 API

使用貼文、媒體、表情回應與追蹤功能建構活動流與社交動態流,並將新貼文即時推送給每一個用戶端。

從任何技術堆疊呼叫 API

提供 cURL 以及面向 Node、Python、PHP、Ruby、Go、Java、Rust、Swift 與 C++ 的型別化 SDK。200 多個端點涵蓋評論、投票、頁面、SSO 使用者、動態流貼文、審核與通知,全部由單一 API 金鑰統一管理。

安裝npm install fastcomments-sdk
import { createFastCommentsSDK } from 'fastcomments-sdk/server';

const sdk = createFastCommentsSDK({
  apiKey: 'your-api-key',               // server-side only
  basePath: 'https://fastcomments.com'  // optional (default)
});

// Fetch comments for a page
const { comments } = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

// Post a comment
await sdk.publicApi.createCommentPublic({
  tenantId: 'your-tenant-id',
  broadcastId: crypto.randomUUID(),
  createComment: {
    urlId: 'page-url-id',
    url: 'https://example.com/post',
    comment: 'Hello from the API!',
    commenterName: 'Alice'
  }
});
# Fetch comments for a page
curl -s 'https://fastcomments.com/api/v1/comments?tenantId=your-tenant-id&urlId=page-url-id' \
  -H 'x-api-key: YOUR_API_KEY'
安裝pip install fastcomments
import client
from client.api.public_api import GetCommentsPublicOptions

configuration = client.Configuration(host="https://fastcomments.com")
with client.ApiClient(configuration) as api_client:
    api = client.PublicApi(api_client)
    response = api.get_comments_public(
        "your-tenant-id",
        "page-url-id",
        GetCommentsPublicOptions(page=0, limit=30),
    )
    for comment in response.comments:
        print(comment.commenter_name, comment.comment)
安裝composer require fastcomments/fastcomments-php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api = new FastComments\Client\Api\PublicApi(new GuzzleHttp\Client());

$result = $api->getCommentsPublic('your-tenant-id', 'page-url-id', [
    'page'  => 0,
    'limit' => 30,
]);

foreach ($result->getComments() as $comment) {
    echo $comment->getCommenterName() . ': ' . $comment->getComment() . PHP_EOL;
}
安裝gem install fastcomments
require 'fastcomments-client'

api = FastCommentsClient::PublicApi.new
result = api.get_comments_public('your-tenant-id', 'page-url-id', { page: 0, limit: 30 })

result.comments.each do |comment|
  puts "#{comment.commenter_name}: #{comment.comment}"
end
安裝go get github.com/fastcomments/fastcomments-go
package main

import (
	"context"
	"fmt"
	openapiclient "github.com/fastcomments/fastcomments-go/client"
)

func main() {
	client := openapiclient.NewAPIClient(openapiclient.NewConfiguration())

	resp, _, err := client.PublicAPI.
		GetCommentsPublic(context.Background(), "your-tenant-id").
		UrlId("page-url-id").Page(0).Limit(30).Execute()
	if err != nil {
		panic(err)
	}
	for _, c := range resp.Comments {
		fmt.Printf("%s: %s\n", c.GetCommenterName(), c.GetComment())
	}
}
import com.fastcomments.invoker.ApiClient;
import com.fastcomments.invoker.Configuration;
import com.fastcomments.api.PublicApi;

ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://fastcomments.com");

PublicApi api = new PublicApi(client);
var result = api.getCommentsPublic("your-tenant-id", "page-url-id")
                .page(0)
                .limit(30)
                .execute();
System.out.println(result.getComments());
use fastcomments_sdk::client::apis::configuration::Configuration;
use fastcomments_sdk::client::apis::public_api::{get_comments_public, GetCommentsPublicParams};

let config = Configuration::new();
let params = GetCommentsPublicParams {
    tenant_id: "your-tenant-id".to_string(),
    url_id: "page-url-id".to_string(),
    page: Some(0),
    limit: Some(30),
    ..Default::default()
};
let result = get_comments_public(&config, params).await.unwrap();
for comment in result.comments {
    println!("{:?}: {:?}", comment.commenter_name, comment.comment);
}
import FastCommentsSwift

var options = PublicAPI.GetCommentsPublicOptions()
options.page = 0
options.limit = 30

let result = try await PublicAPI.getCommentsPublic(
    tenantId: "your-tenant-id",
    urlId: "page-url-id",
    options: options
)
print(result.comments ?? [])
#include "FastCommentsClient/api/PublicApi.h"
#include "FastCommentsClient/ApiClient.h"
#include "FastCommentsClient/ApiConfiguration.h"

using namespace org::openapitools::client::api;

auto config = std::make_shared<ApiConfiguration>();
config->setBaseUrl(utility::conversions::to_string_t("https://fastcomments.com"));

PublicApi publicApi(std::make_shared<ApiClient>(config));

auto resp = publicApi.getCommentsPublic(
    utility::conversions::to_string_t("your-tenant-id"),
    utility::conversions::to_string_t("page-url-id")
).get();

訂閱即時動態流

建立一條連線,即可在每一則新評論、編輯、投票與線上狀態更新發生的瞬間收到通知。不會遺漏任何事件:重新連線時會重新擷取 event log,重播用戶端離線期間送出的所有內容。原生 WebSocket 訂閱器適用於 Node、React Native、Java、Swift 與 C++。其他所有語言均可透過輪詢 event log 保持即時。

安裝npm install fastcomments-sdk
import { subscribeToChanges, LiveEventType } from 'fastcomments-sdk/browser';

const config = { tenantId: 'your-tenant-id', urlId: 'page-url-id' };

const subscription = subscribeToChanges(
  config,
  'your-tenant-id',   // tenantIdWS
  'page-url-id',      // urlIdWS
  'user-session-id',  // userIdWS (from the getComments response)
  (event) => {
    if (event.type === LiveEventType.new_comment) {
      console.log('New comment:', event.comment?.comment);
    }
    return true;      // event handled
  },
  (isConnected) => console.log(isConnected ? 'connected' : 'disconnected')
);

// later: subscription.close();
安裝npm install fastcomments-react-native-sdk
import React, { useState } from 'react';
import { FastCommentsLiveCommenting } from 'fastcomments-react-native-sdk';
import { FastCommentsCommentWidgetConfig } from 'fastcomments-typescript';

export default function Comments() {
  // <FastCommentsLiveCommenting> subscribes to the live feed automatically.
  const [config] = useState<FastCommentsCommentWidgetConfig>({
    tenantId: 'your-tenant-id',
    urlId: 'page-url-id',
    showLiveRightAway: true,
    countAll: true,
  });

  return <FastCommentsLiveCommenting config={config} />;
}
import com.fastcomments.pubsub.LiveEventSubscriber;
import com.fastcomments.pubsub.SubscribeToChangesResult;
import com.fastcomments.core.CommentWidgetConfig;
import com.fastcomments.model.LiveEventType;

CommentWidgetConfig config = new CommentWidgetConfig();
config.tenant = "your-tenant-id";
config.urlId = "page-url-id";

LiveEventSubscriber subscriber = new LiveEventSubscriber();
SubscribeToChangesResult result = subscriber.subscribeToChanges(
    config,
    "your-tenant-id",   // tenantIdWS
    "page-url-id",      // urlId
    "page-url-id",      // urlIdWS
    "my-presence-id",   // userIdWS
    null,               // canSeeCommentsCallback (optional)
    (event) -> {
        if (event.getType() == LiveEventType.NEW_COMMENT) {
            System.out.println("New comment: " + event.getComment().getId());
        }
    }
);
// later: result.close();
import FastCommentsSwift

let config = LiveEventConfig(
    tenantId: "your-tenant-id",
    urlId: "page-url-id",
    urlIdWS: "page-url-id",   // URL-safe id for the WS server
    userIdWS: "my-presence-id"
)

let subscriber = LiveEventSubscriber()
let result = subscriber.subscribeToChanges(config: config) { event in
    if event.type == .newComment, let comment = event.comment {
        print("New comment: \(comment.id ?? "")")
    }
}
// later: result?.close()
#include <fastcomments/live/live_stream.hpp>
#include <iostream>

using namespace fastcomments::live;

LiveStreamConfig cfg;
cfg.wsBaseUrl = "wss://fastcomments.com";   // no trailing slash

LiveStream stream(cfg);
stream.onEvent([](const LiveEvent& ev) {
    if (ev.type == EventType::NewComment) {
        std::cout << "New comment at " << ev.timestamp << std::endl;
    }
});

stream.subscribe("your-tenant-id", "page-url-id", "my-presence-id").wait();
// later: stream.close().wait();
安裝pip install fastcomments
import time
import client

configuration = client.Configuration(host="https://fastcomments.com")
with client.ApiClient(configuration) as api_client:
    api = client.PublicApi(api_client)
    start_time = int(time.time() * 1000)  # ms epoch
    while True:
        result = api.get_event_log(
            "your-tenant-id", "page-url-id", "my-user-id", start_time
        )
        for event in result.events:
            print("event:", event.data)
            start_time = int(event.created_at.timestamp() * 1000) + 1
        time.sleep(2)
# startTime = epoch millis to replay from; advance it past the last event you saw
curl -s 'https://fastcomments.com/api/v1/event-log/your-tenant-id?urlId=page-url-id&userIdWS=my-user-id&startTime=1720560000000' \
  -H 'x-api-key: YOUR_API_KEY'

原生行動端 SDK,即插即用

無需自行建構與維護評論 UI。我們為 React Native、Android 與 iOS 提供的專用、持續維護的 SDK 內建原生 UI 元件,支援巢狀評論、即時聊天與動態流。放入一個視圖、傳入設定,即可完成。

React Native

npm: fastcomments-react-native-sdk

原生元件,無 webview。放入 FastCommentsLiveCommenting、FastCommentsLiveChat 或 FastCommentsFeed 並傳入設定即可。

查看即時示範

Android

com.fastcomments:sdk

原生 Android UI 元件。將 FastCommentsView 加入你的版面配置,即可獲得巢狀評論、投票、通知與動態流。支援 Android 8.0+。

在 GitHub 上查看

iOS

Swift Package: FastCommentsUI

一個用於巢狀評論、社交動態流與即時聊天的原生 SwiftUI 函式庫。支援 iOS 16+ 與 macOS 14+。

在 GitHub 上查看

那些原本需要你自己建構的部分

200+ 個 REST 端點

一個 API 金鑰,一個基礎 URL。儀表板能做的一切,你的程式碼也能做到。

10+ 種語言的 SDK

面向 Node、Python、PHP、Ruby、Go、Java、Rust、Swift、C++ 等的型別化用戶端,讓你在自己的技術堆疊中建構,而非受限於我們的。

基於 WebSockets 的即時能力

新評論在發布的瞬間即可送達每一位讀者,無需重新整理,也無需輪詢。若讀者重新連線,遺漏的事件會從日誌中重播。

審核、SSO 與垃圾訊息防護

單一登入、評論審核與垃圾訊息過濾均已內建,在你寫下第一行程式碼之前,最棘手的部分就已處理妥當。

為你託管並彈性擴展

我們在全球網路中執行儲存與即時基礎設施。你只需呼叫 API 並發布上線。

你可以建構什麼

一套 API 與 SDK,支撐起 Web、行動與伺服器應用中的評論串、聊天與即時活動。

即時聊天室

將訊息即時推送給房間內的每個人,並顯示線上人數與輸入動態。

評論串

只需幾次 API 呼叫,即可為文章、產品與貼文加入可巢狀、可投票的評論區。

活動流

向動態流發文,並在新項目與表情回應到達時推送給已連線的用戶端。

問答與投票

收集問題、答案、投票與投票結果,然後即時排序並展示。

三步即可上線

1

取得你的 API 金鑰

開始免費試用,從儀表板取得你的租戶 ID 與 API 金鑰。

2

安裝 SDK

加入對應語言的 SDK,或使用 cURL 與你的 x-api-key 標頭直接呼叫 REST API。

3

擷取、發布並上線

載入評論,從後端發布,並訂閱變更,將更新即時推送給每一位讀者。

全球分散式部署,高度可用

FastComments 在我們自有的基礎設施上跨多個區域執行。寫入操作在區域間複寫,節點自動故障轉移,讀者由離其最近的位置提供服務。

多主,多區域

寫入操作可在多個區域被接受並在其間複寫,因此不存在單點故障。

我們自有的邊緣網路

評論與媒體由我們自有的全球 CDN 與 DNS 提供服務,從離你的使用者最近的位置送達。不依賴第三方 CDN。

自動故障轉移

冗餘節點自行進行故障轉移,因此即使發生故障,流量也能持續流轉。以 99.99% 的正常運作時間為保障。

區域資料駐留

可在 US 或 EU 執行。位於 eu.fastcomments.com 的 EU 區域將資料保留在本區域內,以符合合規要求。

加入我們快樂的客戶行列

成千上萬的滿意客戶信賴我們卓越的服務、可靠的品質和創新的解決方案。加入我們不斷成長的社群,立即體驗與眾不同!

開始使用

評論 API 常見問題

我必須使用 FastComments 小工具嗎?

不需要。小工具是選用的。你可以完全基於 REST API 與 SDK 建構整套評論體驗,並自行渲染所有內容。

哪些語言有 SDK?

Node、Python、PHP、Ruby、Go、Java、Rust、Swift、C++ 與 Nim,再加上面向行動端的 React Native SDK。任何語言也都可以直接呼叫 REST API。

即時功能是如何運作的?

用戶端建立一條 WebSocket 連線,以事件形式接收新評論、編輯、投票與線上狀態更新,因此無需重新整理,也無需輪詢。不會遺漏任何事件:若用戶端斷線,會在重新連線時重新擷取 event log,重播離線期間送出的所有內容。

我需要自己執行 WebSocket 伺服器嗎?

不需要。FastComments 託管即時基礎設施。你的用戶端透過 SDK 訂閱,我們負責投遞事件。

沒有原生訂閱器的語言如何保持即時?

它們輪詢 event log 端點,該端點會回傳自某一時間戳記以來的每一項變更。而 Node、React Native、Java、Swift 與 C++ 的 SDK 則內建了原生 WebSocket 訂閱器。

分頁是如何運作的?

針對評論,FastComments 會在每次寫入時預先計算分頁,以獲得最佳載入速度,因此即使是超大的評論串也能快速分頁。

有免費試用嗎?

有。開始免費試用,可完整存取 API 與 SDK,無需信用卡。試用結束後,付費方案會隨你的流量彈性擴展。

API 文件在哪裡?

完整的 REST API 與 SDK 參考文件位於 docs.fastcomments.com,其中記錄了每一個端點、參數與回應。

我可以將資料保留在 EU 嗎?

可以。FastComments 在 eu.fastcomments.com 提供 EU 區域,且 SDK 支援路由到該區域。

幾分鐘即可開始建構

開始免費試用,取得你的 API 金鑰,今天就為你的應用加入即時討論。