TurboSMS API 互換性
SMSBAT は TurboSMS API との互換レイヤーに完全に対応しています。これにより、TurboSMS 向けに作成された既存の連携を、メッセージ構造やエンドポイントのペイロードを書き直すことなく、そのまま SMSBAT に移行できます。
SMS と Viber メッセージ (カルーセルやアンケートなどの高度な機能を含む) の送信、ステータスの取得、メッセージ詳細の取得に対応しており、すでにお使いのリクエストボディ構造をそのまま利用できます。
認証
ネイティブの TurboSMS API との唯一の違いは認証方式です。TurboSMS ではカスタムの token クエリパラメーターまたは専用の認証ヘッダーを使用しますが、SMSBAT では標準の Bearer Token が必要です。
すべてのリクエストの Authorization ヘッダーに SMSBAT API トークンを含める必要があります。
Authorization: Bearer YOUR_SMSBAT_TOKEN
ベース URL
すべてのエンドポイントは、SMSBAT API のベース URL に向けて送信してください。
https://restapi.smsbat.com
単一メッセージの送信
エンドポイント: POST /api/tsms/message/send
ハイブリッド配信 (Viber を優先し、SMS にフォールバック) に対応した SMS と Viber メッセージの送信が可能です。1 件の送信リクエストを処理し、受信者ごとの配信結果を返します。
主な機能
- 柔軟なパラメーター: グローバルパラメーターは、SMS / Viber 固有のパラメーターで上書きできます。
- コンテンツ: Viber のカルーセル、アンケート、ファイル添付、インタラクティブボタンに対応しています。
- エラー処理: エラーの場合でも HTTP 200 を返します (構造化されたエラーレスポンス)。システムエラーの場合は、ステータス
FATAL_ERRORとともにresponse_code: 999が返されます。 - 受信者ごとのエラー: 受信者固有のエラーは
response_result配列で返されます。失敗した受信者はmessage_id: nullと固有のエラーコードを持ちます。
リクエスト例 (ハイブリッドメッセージ)
{
"sender": "GlobalSender",
"text": "Test message",
"recipients": ["380951111111", "380952222222"],
"start_time": "2025-09-29T10:00:00Z",
"sequence_id": "seq_12345",
"sms": {
"sender": "SMSSender",
"text": "SMS version of message",
"is_flash": false
},
"viber": {
"sender": "ViberSender",
"text": "Viber version of message",
"ttl": 3600,
"image_url": "https://example.com/image.png",
"caption": "Button text",
"action": "https://google.com",
"count_clicks": true,
"is_transactional": false
}
}
リクエスト例 (Viber カルーセル)
{
"sender": "GlobalSender",
"text": "Check out our products",
"recipients": ["380951111111"],
"viber": {
"sender": "ViberSender",
"text": "Check out our products",
"is_transactional": false,
"carousel": [
{
"title": "Product 1",
"image_url": "https://example.com/product1.jpg",
"button_caption": "Buy Now",
"button_url": "https://example.com/buy/product1",
"link_caption": "Learn More",
"link_url": "https://example.com/product1"
},
{
"title": "Product 2",
"image_url": "https://example.com/product2.jpg",
"button_caption": "Buy Now",
"button_url": "https://example.com/buy/product2",
"link_caption": "Learn More",
"link_url": "https://example.com/product2"
}
]
}
}
リクエスト例 (Viber アンケート)
{
"sender": "GlobalSender",
"text": "Please rate our service",
"recipients": ["380951111111"],
"viber": {
"sender": "ViberSender",
"text": "Please rate our service",
"is_transactional": true,
"survey": [
"Excellent",
"Good",
"Average",
"Poor"
]
}
}
複数メッセージの送信 (バッチ)
エンドポイント: POST /api/tsms/message/sendmulti
このメソッドを使うと、複数の send リクエストを 1 回の HTTP リクエストで送信でき、接続のオーバーヘッドを削減できます。100 件分のデータで sendmulti を呼び出す方が、100 回個別に send リクエストを実行するよりも高速です。
リクエスト例
{
"batch_1": {
"sender": "GlobalSender",
"text": "Test message",
"recipients": ["380982462128", "380501111111"],
"sms": {
"sender": "SMSSender",
"text": "SMS version of message"
}
},
"batch_2": {
"sender": "GlobalSender",
"text": "Second message",
"recipients": ["380501111111"],
"viber": {
"sender": "ViberSender",
"text": "Viber message",
"is_transactional": true
}
}
}
レスポンス例
{
"response_code": 0,
"response_status": "OK",
"response_result": {
"batch_1": {
"response_code": 800,
"response_status": "SUCCESS_MESSAGE_ACCEPTED",
"response_result": [
{
"phone": "380982462128",
"response_code": 0,
"message_id": "f1640579-ea75-4bc1-b708-1c3858bf222d",
"response_status": "OK"
}
]
},
"batch_2": { ... }
}
}
メッセージステータスの取得
エンドポイント: POST /api/tsms/message/status
message_id を指定して、送信済みメッセージの配信ステータスを取得します。
リクエスト例
{
"messages": [
"573dcb46-7851-4e16-bb1f-721c13ef5f38",
"6b7f9ff5-28c8-4f38-913b-31af6021fbea"
]
}
メッセージ詳細の取得
エンドポイント: POST /api/tsms/message/details
作成済みメッセージの詳細情報 (SMS と Viber チャネルの完全なペイロードの詳細、料金、正確なタイムスタンプなど) を取得できます。
リクエスト例
{
"messages": [
"573dcb46-7851-4e16-bb1f-721c13ef5f38",
"f1640579-ea75-4bc1-b708-1c3858bf222d"
]
}
レスポンス例
{
"response_code": 0,
"response_status": "OK",
"response_result": [
{
"message_id": "573dcb46-7851-4e16-bb1f-721c13ef5f38",
"sms": null,
"viber": {
"added": "2025-09-29T14:17:02.577Z",
"start": "2025-09-29T10:00:00Z",
"sent": "2025-09-29T14:17:02.577Z",
"updated": "2025-09-29T14:17:02.577Z",
"sender": "ViberSender",
"text": "Viber version of message",
"recipient": "380982462128",
"message_type": "promotional",
"status": "Queued",
"price": 0,
"ttl": 3600,
"caption": "Button text",
"action": "https://google.com"
},
"response_code": 0,
"response_status": "OK"
}
]
}