# Braze Currents Import Integration

Brazeプラットフォームは、新しい成長機会やブランドインタラクションに関する洞察を提供し、革新的なキャンペーンの構築や戦略的なアクションの実行を支援します。Braze Currentsを使用すると、データをTreasure Dataにプッシュし、成長スタック全体で活用可能にすることができます。

Braze Streaming Ingress Connectorは、BrazeからTreasure Dataへのリアルタイムデータストリーミングを可能にするネイティブ入力コネクタです。このコネクタは、顧客の信頼を高め、以前のPostback API統合方法の制限を解決します。

## 前提条件

- 適切な権限を持つアクティブなBrazeアカウント
- Treasure アカウントで(ベータ版)Braze Currents Streamingコネクタを有効化(Treasure サポートチームにリクエスト)
- テーブルにイベントを書き込むためのTreasure API Write Key


## 設定

### Treasure コンソールでの設定

1. Connections > New Connectionに移動
2. コネクタのリストから「Braze Currents Streaming」を選択
![](/assets/screenshot-2025-04-14-at-12.00.07.d5c9d9649d355179a64b24597b65c6d6a52668310dc73d033cf90c13df800591.98d35268.png)
3. 以下の認証設定を構成:
  - Authentication:
    - TD Write Key(必須)
![](/assets/screenshot-2025-04-14-at-12.00.12.b61785dbf82a372f75d9fcba5628d802262814012105e44243d2600c4d946709.98d35268.png)
4. 以下のSource設定を構成:
  - Connection
    - Source Name
    - ![](/assets/screenshot-2025-04-14-at-17.36.54.0d1bc3506319b83de9aca605f0653b8c796fe2b098dde709eac85c67cb64b009.98d35268.png)
  - Data Settings
    - ![](/assets/screenshot-2025-04-14-at-17.37.29.b72820dd8372d515d1546246beee23b760d58da0d9c058d1780605b81719a4db.98d35268.png)
    - Datastore: Plazma
    - Tags(オプション): このソースを検索するために使用できるタグです。
    - Database(必須): インポート先のデータベース
    - Table(必須): インポート先のテーブル
    - Multiple Tablesオプション(チェックボックス):
      - 有効にすると、Currentsの設定に基づいて、イベントが異なるテーブルに振り分けられます([リンク](https://www.braze.com/docs/user_guide/data/distribution/braze_currents/setting_up_currents/#requirements))
5. Braze設定用のtask_idとしてUnique IDをSourceからコピー
  - ![](/assets/screenshot-2025-07-21-at-23.45.17.38db8408685ac8f35037b449bd3a5a13f5ed79f45baa0da13e2a5147cf42103b.98d35268.png)


### Brazeプラットフォームでの設定

1. Partner Integration → Data Exportに移動
2. 新しいCustom Currentを作成(Treasure Dataを選択するとレガシー連携が使用されます)
3. TD設定時に提供されたTreasure DataエンドポイントURLを入力
  - USリージョン: https://braze-in-streaming.treasuredata.com/v1/task/{task_id}
  - EU01リージョン: https://braze-in-streaming.eu01.treasuredata.com/v1/task/{task_id}
  - AP02リージョン: https://braze-in-streaming.ap02.treasuredata.com/v1/task/{task_id}
  - Tokyoリージョン: https://braze-in-streaming.treasuredata.co.jp/task/v1/{task_id}
4. Bearer Tokenとして「YOUR_WRITE_APIKEY」を入力
![](/assets/screenshot-2025-04-15-at-13.54.35.df00bf9bd51cbae952178a51af79f72e6defaa85be431e2aa52fbcb5f797d552.98d35268.png)
5. エクスポートするイベントタイプを選択


## データ取り込み

コネクタは、JSONデータを自動的に2階層までフラット化します。イベントは、設定に基づいて指定されたテーブルに保存されます。

### データタイプマッピング

| JSON Data Type | Schema Data Type |
|  --- | --- |
| string | string |
| string | string |
| number | long |
| boolean | string |
| array | JSON |
| object | フラット化（レベル2まで） |
| null | 無視 |


### カラム命名規則

- 小文字とアンダースコアのみ
- レベル1フィールド: `field_name`
- レベル2フィールド: `parent_field_name_field_name`


## データのクエリ

取り込まれたデータをクエリするには、SQLクエリを使用します。例:


```sql
SELECT
  id AS event_id,
  event_type,
  time AS event_time,
  user_user_id,
  user_external_user_id,
  properties_dispatch_id,
  properties_campaign_id,
  properties_message_variation_id,
  properties_email_address,
  properties_user_agent,
  properties_campaign_name,
  properties_message_variation_name
FROM
  your_database.your_table
WHERE
  TD_INTERVAL(
    time,
    '-1d',
    'JST'
  )
```

## 制限事項と考慮事項

- 最大ペイロードサイズ: 1 MB
- イベントはデフォルトで100件のバッチにグループ化されます


details
summary
レガシー統合ドキュメント

#### この統合で何ができますか？

Braze Currentsから Treasure Data にデータを移動する推奨アプローチは、[Postback API](/apis/postback/quickstart)を使用することです。この方法では、すぐに使えるコネクタは必要ありません。代わりに、Treasure Data は Postback RESTful API を通じてデータを受信します。1つのデータバッチで送信されるすべてのイベントは、JSON配列の1つの行の1つのフィールド内にあり、必要なデータを取得するためにパースする必要があります。

# 前提条件

- [Postback API](/products/customer-data-platform/integration-hub/streaming/postback-api)を含む Treasure Data の基礎知識。
- [Braze](https://www.braze.com/)の基礎知識。


# 統合

Braze Currentインテグレーションの作成手順は、Brazeのウェブサイト [Treasure Data for Currents](https://www.braze.com/docs/partners/data_and_analytics/customer_data_platform/treasure_data/treasure_data_for_currents/) に記載されています。Brazeは、更新されたイベントをリアルタイムでTreasure Dataに直接送信します。ただし、event-collectorを使用したデータ取り込みには数分かかる場合があります。

Braze CurrentsがTreasure Dataにデータをプッシュした後、次のようなクエリを使用してTreasure コンソールからデータを抽出できます。

| 注意 | 本番環境で使用する前に、クエリの出力結果が有効であることを必ず確認してください。 |

| --- | --- |


```
SELECT  json_extract_scalar(event, '$.id') AS event_id,  json_extract_scalar(event, '$.event_type') AS event_type,  json_extract_scalar(event, '$.time') AS event_time,  json_extract_scalar(json_extract(event, '$.user'), '$.user_id') AS user_id,  json_extract_scalar(json_extract(event, '$.user'), '$.external_user_id') AS external_user_id,  json_extract_scalar(json_extract(event, '$.properties'), '$.dispatch_id') AS dispatch_id,  json_extract_scalar(json_extract(event, '$.properties'), '$.campaign_id') AS campaign_id,  json_extract_scalar(json_extract(event, '$.properties'), '$.message_variation_id') AS message_variation_id,  json_extract_scalar(json_extract(event, '$.properties'), '$.email_address') AS email_address,  json_extract_scalar(json_extract(event, '$.properties'), '$.user_agent') AS user_agent,  json_extract_scalar(json_extract(event, '$.properties'), '$.device_class') AS device_class,  json_extract_scalar(json_extract(event, '$.properties'), '$.device_os') AS device_os,  json_extract_scalar(json_extract(event, '$.properties'), '$.browser') AS browser,  json_extract_scalar(json_extract(event, '$.properties'), '$.ip_pool') AS ip_pool,  json_extract_scalar(json_extract(event, '$.properties'), '$.machine_open') AS machine_open,  json_extract_scalar(json_extract(event, '$.properties'), '$.esp') AS esp,  json_extract_scalar(json_extract(event, '$.properties'), '$.from_domain') AS from_domain,  json_extract_scalar(json_extract(event, '$.properties'), '$.is_amp') AS is_amp,  json_extract_scalar(json_extract(event, '$.properties'), '$.campaign_name') AS campaign_name,  json_extract_scalar(json_extract(event, '$.properties'), '$.message_variation_name') AS message_variation_nameFROM  your_tableCROSS JOIN UNNEST(cast(JSON_PARSE(events) AS array(json))) AS t (event)
```

# 例

**Eventsフィールドの例**


```
{
    "events": [
        {
            "event_type": "users.message.email.Open",
            "id": "a1234567-89ab-cdef-0123-456789abcdef",
            "time": 1477502783,
            "user": {
                "user_id": "user_id",
                "timezone": "America/Chicago"
        },
            "properties": {
                "campaign_id": "11234567-89ab-cdef-0123-456789abcdef",
                "campaign_name": "Test Campaign",
                "dispatch_id": "12345qwert",
                "message_variation_id": "c1234567-89ab-cdef-0123-456789abcdef",
                "email_address": "test@example.com",
                "send_id": "f123456789abcdef01234567",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"
            }
        }
    ]
}
```

**取り込まれたBraze Currents EventsのTreasure コンソールビューの例**![](/assets/image-20220314-023753.24d1a19d8a5a50aed86afbf23ab4d4b277ed0cbf3b716e0b65a6aab091814ef9.98d35268.png)