コメントAPI: ライブディスカッション向け

コメント、モデレーション、ソーシャルフィードを、1つのREST APIと10以上の言語向けSDKで実現します。バックエンドから取得、投稿、モデレーションを行い、新しいアクティビティをWebSocket経由ですべての読者へリアルタイムに配信します。

1つのプラットフォーム、3つのAPI

FastCommentsはコメント機能にとどまりません。同じAPIとSDKスイートでディスカッション、モデレーション、ソーシャルフィードを構築できます。

コメントAPI

スレッド形式のコメントとライブチャット。取得、投稿、投票、ピン留め、返信、検索に対応し、SSOとリアルタイム更新を標準搭載しています。

モデレーションAPI

40以上のエンドポイントを備えた専用のモデレーション機能。承認、フラグ付け、ブロック、BAN、ロック、監査に対応し、自動スパムフィルタリングが支えます。

ソーシャルフィードAPI

投稿、メディア、リアクション、フォローを備えたアクティビティフィードやソーシャルフィードを構築し、新しい投稿をすべてのクライアントへライブ配信します。

あらゆるスタックからAPIを呼び出す

cURLに加え、Node、Python、PHP、Ruby、Go、Java、Rust、Swift、C++向けの型付きSDKを提供します。200以上のエンドポイントがコメント、投票、ページ、SSOユーザー、フィード投稿、モデレーション、通知をカバーし、すべて1つの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();

ライブフィードを購読する

1つの接続を開くだけで、新しいコメント、編集、投票、プレゼンス更新を発生した瞬間に受け取れます。イベントを取りこぼしません。再接続時には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エンドポイント

1つのAPIキー、1つのベースURL。ダッシュボードでできることは、コードからもすべて実行できます。

10以上の言語向けSDK

Node、Python、PHP、Ruby、Go、Java、Rust、Swift、C++などの型付きクライアントを用意。当社ではなく、あなたのスタックで開発できます。

WebSocketによるリアルタイム

新しいコメントは投稿された瞬間にすべての読者へ届きます。更新もポーリングも不要です。読者が再接続すると、取りこぼしたイベントがログから再生されます。

モデレーション、SSO、スパム対策

シングルサインオン、コメントモデレーション、スパムフィルタリングを標準搭載。難しい部分は、あなたが1行書く前に処理済みです。

ホスティングとスケーリングを代行

ストレージとリアルタイムインフラをグローバルネットワークで運用します。あなたはAPIを呼び出してリリースするだけです。

構築できるもの

1つのAPIとSDKスイートが、Web、モバイル、サーバーアプリを横断してコメントスレッド、チャット、ライブアクティビティを支えます。

ライブチャットルーム

ルーム内の全員へメッセージをリアルタイムに配信し、プレゼンス数や入力中の状況も表示できます。

コメントスレッド

数回のAPI呼び出しで、記事、商品、投稿にネスト可能で投票できるコメント欄を追加できます。

アクティビティフィード

フィードに投稿し、新しいアイテムやリアクションを到着と同時に接続中のクライアントへプッシュします。

Q&Aと投票

質問、回答、投票、アンケート結果を収集し、ランク付けしてライブで表示します。

3ステップで公開

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キーを取得し、今日からアプリにライブディスカッションを追加しましょう。