会話作成とメッセージ送信

GET /v1/ask/identity

GET /v1/ask/identity
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
{
  "data": {
    "app": {
      "id": "app_example",
      "name": "Example integration"
    },
    "api_key": {
      "environment": "production",
      "scopes": [
        "supplier_inquiry:read",
        "supplier_inquiry:write"
      ]
    },
    "inquiry": {
      "enabled": true,
      "mapped": true,
      "read": true,
      "write": true,
      "webhook_configured": true
    }
  }
}

サーバーから https://api.hiobuy.com に Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY でアクセスします。HIOBuy 管理者が App の相談機能と V2 接続を設定します。本番チャットには production Key と supplier_inquiry:read / supplier_inquiry:write が必要です。本人確認は有効な Key を受け付け、テスト Key は environment=sandbox を返します。倉庫サービスは必須ではありません。

会話を作成

external_user_id は顧客ごと、external_conversation_id は顧客+商品+会話世代ごとに固定します。ID は 1–128 文字で [A-Za-z0-9][A-Za-z0-9._:@-]{0,127} に一致します。すべての POST に 1–128 文字の印字可能 ASCII の Idempotency-Key が必要です。送信前に本文と Key を保存し、タイムアウト後は同一内容で再試行します。同じ ID に異なる内容は 409。終了後は新しい世代 ID を使用します。

language は任意の BCP 47 顧客言語ヒント(en、ja-JP)です。不明なら省略/null。target_language は顧客向け返信言語です。言語検出と翻訳処理の詳細は非公開で、翻訳プレビューの別呼び出しは不要です。

POST /v1/ask/conversations
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: create-customer-42-product-1
 
{
  "external_conversation_id": "customer-42-1688-673124809943-1",
  "external_user_id": "customer-42",
  "language": "en",
  "context": {
    "type": "product",
    "product_url": "https://detail.1688.com/offer/673124809943.html",
    "product_id": "673124809943",
    "product_title": "Knitted shoulder bag"
  }
}
{
  "data": {
    "id": "11111111-1111-4111-8111-111111111111",
    "external_app_id": "hiobuy:app_example",
    "external_conversation_id": "customer-42-1688-673124809943-1",
    "external_user_id": "customer-42",
    "language": "en",
    "context": {
      "type": "product",
      "product_url": "https://detail.1688.com/offer/673124809943.html",
      "product_id": "673124809943",
      "product_title": "Knitted shoulder bag"
    },
    "target_language": "en",
    "status": "pending",
    "last_message_at": null,
    "created_at": "2026-11-13T13:00:00.000Z",
    "updated_at": "2026-11-13T13:00:00.000Z"
  }
}

メッセージを送信

data.id を保存し、固定 client_message_id(1–128 文字)で最初のメッセージを送信します。type=text、最大 10,000 Unicode コードポイント、カードなしでは空にできません。product_card は最初の顧客メッセージのみ。URL は正規 HTTPS 1688/Taobao/Tmall 商品リンク、タイトル 1–200 文字、任意価格は最大 64 文字です。UUID 例は応答値に置換します。

POST /v1/ask/conversations/11111111-1111-4111-8111-111111111111/messages
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: send-customer-message-001
 
{
  "client_message_id": "customer-message-001",
  "type": "text",
  "content": "Can the supplier provide neutral packaging?",
  "product_card": {
    "url": "https://detail.1688.com/offer/673124809943.html",
    "title": "Knitted shoulder bag",
    "price_label": "CNY 6.50"
  }
}

201 Created / 200 OK

公開履歴は顧客原文と公開済み返信(customer / staff)で、私有下書き・内部原稿・メモは含みません。明示的に有効化された互換連携では翻訳後すぐ公開し、固定待機はありません。撤回はサーバー公開トランザクションから 30 秒です。この期限は公開 API にないため、created_at や Webhook 到着時刻から推定しないでください。未対応連携は従来の公開前待機を維持します。撤回後は同じ ID・順序で recalled_at と空 content、メディアなしの確定済み表示を残します。status=recalled を作らないでください。受信 translation_status=pending は配信失敗ではなく、顧客原文を保持します。

Inquiry Demo  と MIT ソース  を参照してください。デモは Key と単一商品をサーバーで設定します。独自連携には自分の production Key・商品・チャネル・HTTPS Webhook を設定します。デモ・テストでは context.source=inquiry_demo を指定し、通常の連携では省略します。

履歴・終了・評価 · Webhook と配信

画像

HIOBuy に画像権限を確認します。バックエンドから PNG/JPEG/WebP のバイナリを、安定した Idempotency-Key、対応する Content-Type、X-Image-Filename と送ります(非 ASCII はパーセントエンコード、復号後最大 128 文字)。multipart、base64 JSON、URL は使用しません。送信前に最大 2400 × 2400 ピクセルへ比率を保って縮小し、10 MiB 以下にします。応答はメタデータのみで公開 URL ではありません。

同じ会話の未使用・有効期限内かつ権限のある attachment_ids を最大 4 個送信します。画像のみは type=image、content=""、文字付きは type=text。初回 product_card.image_attachment_id も attachment_ids に含めます。顧客の会話権限を検証し、アップロードと送信のキー・ID は個別に保存します。

curl --request POST \
  'https://api.hiobuy.com/v1/ask/conversations/11111111-1111-4111-8111-111111111111/attachments' \
  --header 'Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY' \
  --header 'Idempotency-Key: upload-packaging-001' \
  --header 'Content-Type: image/png' \
  --header 'X-Image-Filename: packaging.png' \
  --data-binary '@packaging.png'
{
  "data": {
    "id": "33333333-3333-4333-8333-333333333333",
    "filename": "packaging.png",
    "content_type": "image/png",
    "size": 12345,
    "width": 1200,
    "height": 800,
    "content_path": "/v1/ask/attachments/33333333-3333-4333-8333-333333333333/content"
  }
}
POST /v1/ask/conversations/11111111-1111-4111-8111-111111111111/messages
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: send-packaging-001
 
{
  "client_message_id": "customer-image-001",
  "type": "image",
  "content": "",
  "attachment_ids": [
    "33333333-3333-4333-8333-333333333333"
  ]
}

content_path を https://api.hiobuy.com に対して解決し、サーバー Bearer Key と読取権限で取得して、会話の認可済み顧客にのみ中継します。Key や公開 R2 URL を露出しません。?download=1 はダウンロード指定です。撤回後は媒体表示・公開キャッシュを除去します。ウイルス検査・メタデータ削除・再エンコードは保証しません。制限違反は HTTP 413/415/422 等、権限未開通は 502 HIOASK_INTEGRATION_REJECTED となる場合があります。

Get Support

Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days

Email support