> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therefrain.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SaaS 間データ連携

> API 連携のない 2 つの SaaS を自動でつなぐ。開発不要のデータブリッジ。

## 概要

多くの組織は互いに連携しない SaaS ツールを使っています。API がなければ、一方のツールからデータをエクスポートし、フォーマットを整え、もう一方に手入力するしかありません。手間がかかり、ミスも発生しやすく、スケールしません。

Refrain は 2 つの手順書を連鎖させてこのギャップを埋めます。1 つ目でソースアプリからデータを抽出し、2 つ目でデスティネーションアプリに入力します。カスタムミドルウェアやインテグレーションプラットフォームは不要です。

## 手順書の例

**ステップ 1: ソースから抽出**

```yaml theme={null}
name: extract-from-crm
url: https://crm.example.com/contacts
variables:
  - name: username
    source: secrets
  - name: password
    source: secrets
steps:
  - action: input
    selector: "#email"
    value: "{{ username }}"
  - action: input
    selector: "#password"
    value: "{{ password }}"
  - action: click
    selector: "#login"
  - action: wait
    selector: ".contacts-table"
  - action: click
    selector: ".export-button"
  - action: download
    selector: ".download-csv"
```

**ステップ 2: デスティネーションに入力**

```yaml theme={null}
name: import-to-billing
url: https://billing.example.com/customers/new
variables:
  - name: company_name
    source: data
  - name: contact_email
    source: data
steps:
  - action: input
    selector: "#companyName"
    value: "{{ company_name }}"
  - action: input
    selector: "#contactEmail"
    value: "{{ contact_email }}"
  - action: click
    selector: "#create"
  - action: wait
    selector: ".success"
```

## 生成と実行

<Steps>
  <Step title="抽出用の手順書を生成する">
    ```bash theme={null}
    npx @refrainai/cli generate -- \
      --url https://crm.example.com/contacts \
      --goal "ログインして連絡先リストを CSV でエクスポートする" \
      --context ./context.md \
      --output ./extract-contacts.yaml
    ```
  </Step>

  <Step title="入力用の手順書を生成する">
    ```bash theme={null}
    npx @refrainai/cli generate -- \
      --url https://billing.example.com/customers/new \
      --goal "新規顧客フォームに入力して送信する" \
      --context ./context.md \
      --output ./import-customers.yaml
    ```
  </Step>

  <Step title="連携を実行する">
    ```bash theme={null}
    npx @refrainai/cli execute -- \
      --runbook ./extract-contacts.yaml \
      --secrets ./secrets.json \
      --output-dir ./sync-data

    npx @refrainai/cli execute -- \
      --runbook ./import-customers.yaml \
      --data ./sync-data/contacts.csv
    ```
  </Step>
</Steps>

## Refrain が向いている理由

* **ミドルウェア不要** — カスタム開発なしで任意の 2 つの Web アプリを接続。
* **CSV がブリッジ** — 抽出で CSV を出力し、入力で CSV を消費。シンプルで監査可能。
* **自己修復** — ソース・デスティネーション両方の UI 変更に自動対応。
* **承認ゲート** — デスティネーションへのデータ入力前に人間のレビューを挟める。

## 次のステップ

<CardGroup cols={2}>
  <Card title="手順書を実行する" icon="play" href="/ja/guides/execute-runbook">
    手順書の連鎖実行を学ぶ。
  </Card>

  <Card title="自動修正モード" icon="wrench" href="/ja/guides/self-heal">
    UI 変更時も連携を継続させる。
  </Card>
</CardGroup>
