Terminal Checker API エンドポイント一覧
以下は Terminal Checker が提供する主な API エンドポイントの概要です。
1. 通知関連 API
sendPushNotification
概要: 特定のデバイスに通知を送信するAPI
使い方:
// POSTリクエスト
fetch(
"https://us-central1-terminal-checker.cloudfunctions.net/sendPushNotification",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
token: "デバイスのPushyトークン",
title: "通知タイトル",
message: "通知メッセージ",
package: "アプリのパッケージ名", // オプション
}),
},
);
sendPushToTopic
概要: 特定のトピックを購読しているすべてのデバイスに通知を送信
使い方:
// POSTリクエスト
fetch(
"https://us-central1-terminal-checker.cloudfunctions.net/sendPushToTopic",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
topic: "トピック名",
title: "通知タイトル",
message: "通知メッセージ",
}),
},
);
2. Customer.io連携 API
sendCustomerIoInvite
概要: ユーザーをCustomer.ioに登録し招待イベントを送信するAPI
使い方:
// Firebaseクライアントから呼び出し
const sendInvite = firebase.functions().httpsCallable("sendCustomerIoInvite");
sendInvite({
uid: "ユーザーID",
email: "ユーザーメール",
token: "招待トークン",
});
registerAccountToCustomerIO
概要: ユーザーアカウントをCustomer.ioに登録するAPI
使い方:
// Firebaseクライアントから呼び出し
const registerAccount = firebase
.functions()
.httpsCallable("registerAccountToCustomerIO");
registerAccount({
email: "ユーザーメール",
});
deleteDeviceFromCustomerIO
概要: デバイスがFirestoreから削除された時にCustomer.ioからも削除するトリガー
使い方: 自動トリガー(Firestoreのdevices/{terminalId}ドキュメント削除時に実行)
3. メール・ユーザー管理 API
checkEmailStatus
概要: メールアドレスの招待/登録状態をチェックするAPI
使い方:
// Firebaseクライアントから呼び出し
const checkEmail = firebase.functions().httpsCallable("checkEmailStatus");
checkEmail({
email: "チェックするメールアドレス",
}).then((result) => {
// 結果: "already_invited", "already_registered", "ok_to_invite"
console.log(result.data.status);
});
4. データ収集 API
runScrapeSteraMarket
概要: Stera端末向けアプリ情報をスクレイピングして保存するAPI
使い方:
// GETリクエスト
fetch(
"https://us-central1-terminal-checker.cloudfunctions.net/runScrapeSteraMarket",
)
.then((response) => response.text())
.then((result) => console.log(result));
5. システム内部トリガー
registerPushyTokenToCustomerIO
概要: デバイス情報が更新されるとPushyトークンをCustomer.ioに同期するトリガー
使い方: 自動トリガー(Firestoreのdevices/{terminalId}ドキュメント更新時に実行)
enrichLauncherApps
概要: デバイスのランチャーアプリ情報を拡張するトリガー
使い方: 自動トリガー(Firestoreのdevices/{terminalId}ドキュメント更新時に実行)