---
title: "インストール後のアクションとオンボーディング | Tajo"
description: "Stripe アプリのインストール後の挙動を設定し、効果的なオンボーディングフローを構築します"
url: https://tajo.io/jp/docs/stripe-apps/post-install/
markdown: https://tajo.io/jp/docs/stripe-apps/post-install.md
lang: ja-JP
author: "Set Noa"
author_url: https://tajo.io/jp/set-noa/
robots: noindex
---

先行利用を申し込む

お名前と会社のメールアドレスを入力してください。Tajoへのアクセス申請を確認するためのリンクをメールでお送りします。

# インストール後のアクションとオンボーディング

[Set Noa](https://tajo.io/jp/set-noa/)

インストール後のアクションは、ユーザーが Stripe アプリをインストールした直後に何が起こるかを決めます。よく設計されたインストール後の体験は、ユーザーを設定へ導き、アクティベーション率を高めます。

Caution

**ステータス: 予定、未構築です。** Tajo には Stripe App がないため、このセクションの内容は現時点で何もインストールできません。このページに登場するアプリ識別子、URL、認証情報はすべて説明用のプレースホルダーであり、実際に動作するエンドポイントではありません。

## インストール後のアクションの種類

Stripe は 4 種類のインストール後アクションに対応しており、いずれもアプリのマニフェストで設定します。

### 1. アプリへのリンク（デフォルト）

既定のドロワービューポートでアプリを開きます。`post_install_action` を指定しない場合の既定の挙動です。

```json
{
  "post_install_action": {
    "type": "default"
  }
}
```

ユーザーには Stripe ダッシュボードのサイドバーでアプリの `drawer.default` ビューポートが表示されます。

### 2. オンボーディングへのリンク

アプリ専用のオンボーディングビューを開き、設定に集中できる体験を提供します。

```json
{
  "post_install_action": {
    "type": "onboarding"
  }
}
```

これにはマニフェストで `onboarding` ビューポートを宣言しておく必要があります。

```json
{
  "ui_extension": {
    "views": [
      {
        "viewport": "stripe.dashboard.onboarding",
        "component": "OnboardingView"
      }
    ]
  },
  "post_install_action": {
    "type": "onboarding"
  }
}
```

### 3. 設定へのリンク

アプリの設定ビューを開きます。利用前に API キーや構成が必要なアプリで役立ちます。

```json
{
  "post_install_action": {
    "type": "settings"
  }
}
```

これには `settings` ビューポートが必要です。

```json
{
  "ui_extension": {
    "views": [
      {
        "viewport": "stripe.dashboard.settings",
        "component": "SettingsView"
      }
    ]
  },
  "post_install_action": {
    "type": "settings"
  }
}
```

### 4. 外部 URL へのリンク

設定のためにユーザーを外部の URL へリダイレクトします。オンボーディングフローが Stripe ダッシュボードの外にある場合に使用します。

```json
{
  "post_install_action": {
    "type": "external",
    "url": "https://app.tajo.io/stripe/setup"
  }
}
```

Caution

外部 URL は HTTPS を使用し、`allowed_redirect_uris` に登録しておく必要があります。Stripe の審査チームは、その外部 URL が実際に機能する設定体験を提供しているかを確認します。

## オンボーディングのベストプラクティス

### 手間をかけさせない

利用開始までに必要な手順を最小限にします。

- Stripe アカウントのコンテキストから取得できる**情報をあらかじめ入力**します
- 設定項目には**妥当な既定値**を使用します
- 任意の手順は**スキップできる**ようにし、後から完了できる導線を明示します
- 複数ステップのフローではステップ表示で**進捗を示します**

### カスタマイズできるようにする

ユーザーが自分のニーズに合わせて連携を設定できるようにします。

- **データマッピングの選択肢**、どの Stripe のフィールドを Brevo に同期するかをユーザーが選べるようにします
- **同期の頻度**、1 時間ごと、1 日ごとの同期を選べるようにします
- **選択的な同期**、どの顧客や商品を同期するかをユーザーが選べるようにします
- **通知の設定**、同期エラーや重要なイベントのアラートを設定できるようにします

### 関連性を持たせる

価値をすぐに示します。

- 連携を有効にする前に**同期されるデータをプレビュー**できるようにします
- 設定を完了すると**何が起こるかを示します**
- 接続が機能するか確認できる**テスト同期**の手段を提供します
- 初回同期の完了後に**成果の指標を表示**します

## OnboardingView コンポーネント

`OnboardingView` コンポーネントは、ユーザーがアプリをインストールしたときに集中しやすいモーダルとして描画されます。

```typescript
import {
  Box,
  Button,
  Inline,
  Icon,
  Banner,
  TextField,
  Select,
  Divider,
} from '@stripe/ui-extension-sdk/ui';
import type { ExtensionContextValue } from '@stripe/ui-extension-sdk/context';
import { useState } from 'react';

const OnboardingView = ({ environment, userContext }: ExtensionContextValue) => {
  const [step, setStep] = useState(1);
  const [brevoApiKey, setBrevoApiKey] = useState('');
  const [syncMode, setSyncMode] = useState('hourly');
  const [isConnecting, setIsConnecting] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const totalSteps = 3;

  const handleConnect = async () => {
    setIsConnecting(true);
    setError(null);

    try {
      // Store the API key securely
      await storeBrevoApiKey(brevoApiKey);

      // Verify the connection
      const result = await verifyBrevoConnection(brevoApiKey);

      if (result.success) {
        setStep(2);
      } else {
        setError('Unable to connect to Brevo. Please check your API key.');
      }
    } catch (err) {
      setError('Connection failed. Please try again.');
    } finally {
      setIsConnecting(false);
    }
  };

  return (
    <Box css={{ padding: 'large' }}>
      {/* Progress indicator */}
      <Inline css={{ marginBottom: 'large' }}>
        Step {step} of {totalSteps}
      </Inline>

      {error && (
        <Banner type="critical" title="Connection Error">
          {error}
        </Banner>
      )}

      {step === 1 && (
        <Box>
          <Inline css={{ fontWeight: 'bold', fontSize: 'large' }}>
            Connect Your Brevo Account
          </Inline>
          <Inline css={{ marginTop: 'small', color: 'secondary' }}>
            Enter your Brevo API key to start syncing customer data.
          </Inline>

          <TextField
            label="Brevo API Key"
            placeholder="xkeysib-..."
            value={brevoApiKey}
            onChange={(e) => setBrevoApiKey(e.target.value)}
            css={{ marginTop: 'medium' }}
          />

          <Inline css={{ marginTop: 'xsmall', color: 'secondary', fontSize: 'small' }}>
            Find your API key in Brevo under Settings &gt; SMTP &amp; API &gt; API Keys
          </Inline>

          <Button
            type="primary"
            onPress={handleConnect}
            disabled={!brevoApiKey || isConnecting}
            css={{ marginTop: 'medium' }}
          >
            {isConnecting ? 'Connecting...' : 'Connect Brevo'}
          </Button>
        </Box>
      )}

      {step === 2 && (
        <Box>
          <Inline css={{ fontWeight: 'bold', fontSize: 'large' }}>
            Configure Sync Settings
          </Inline>

          <Select
            label="Sync Mode"
            value={syncMode}
            onChange={(value) => setSyncMode(value)}
            css={{ marginTop: 'medium' }}
          >
            <option value="hourly">Every hour</option>
            <option value="daily">Once per day</option>
          </Select>

          <Divider css={{ marginY: 'medium' }} />

          <Button type="primary" onPress={() => setStep(3)}>
            Continue
          </Button>
          <Button type="secondary" onPress={() => setStep(1)}>
            Back
          </Button>
        </Box>
      )}

      {step === 3 && (
        <Box>
          <Banner type="default" title="Ready to Sync">
            Your Brevo account is connected. Tajo will begin syncing
            customer data automatically.
          </Banner>

          <Box css={{ marginTop: 'medium' }}>
            <Inline css={{ fontWeight: 'bold' }}>What happens next:</Inline>
            <ul>
              <li>Existing Stripe customers will sync to Brevo contacts</li>
              <li>New customers will sync on the schedule you chose</li>
              <li>View sync status on any customer's detail page</li>
            </ul>
          </Box>

          <Button type="primary" onPress={() => {/* Navigate to dashboard */}}>
            Go to Dashboard
          </Button>
        </Box>
      )}
    </Box>
  );
};

export default OnboardingView;
```

## SignInView によるログインフロー

アプリがユーザーに外部アカウント（Tajo など）へのログインを求める場合は、専用のログインビューを使用します。

```typescript
import {
  Box,
  Button,
  Inline,
  TextField,
  Banner,
  Link,
} from '@stripe/ui-extension-sdk/ui';
import { useState } from 'react';

const SignInView = ({ onSignInComplete }) => {
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const handleSignIn = async () => {
    setIsLoading(true);
    setError(null);

    try {
      const response = await fetch('https://api.example.com/v1/auth/stripe-app', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ email, password }),
      });

      if (!response.ok) {
        throw new Error('Invalid credentials');
      }

      const { token } = await response.json();

      // Store the auth token securely in Stripe's Secret Store
      await storeAuthToken(token);

      onSignInComplete();
    } catch (err) {
      setError('Sign-in failed. Please check your credentials and try again.');
    } finally {
      setIsLoading(false);
    }
  };

  return (
    <Box css={{ padding: 'large' }}>
      <Inline css={{ fontWeight: 'bold', fontSize: 'large' }}>
        Sign in to Tajo
      </Inline>
      <Inline css={{ marginTop: 'small', color: 'secondary' }}>
        Connect your Tajo account to enable Brevo sync.
      </Inline>

      {error && (
        <Banner type="critical" title="Sign-in Failed">
          {error}
        </Banner>
      )}

      <TextField
        label="Email"
        type="email"
        value={email}
        onChange={(e) => setEmail(e.target.value)}
        css={{ marginTop: 'medium' }}
      />

      <TextField
        label="Password"
        type="password"
        value={password}
        onChange={(e) => setPassword(e.target.value)}
        css={{ marginTop: 'small' }}
      />

      <Button
        type="primary"
        onPress={handleSignIn}
        disabled={!email || !password || isLoading}
        css={{ marginTop: 'medium' }}
      >
        {isLoading ? 'Signing in...' : 'Sign In'}
      </Button>

      <Link href="https://app.tajo.io/signup" external css={{ marginTop: 'small' }}>
        Don't have a Tajo account? Sign up
      </Link>
    </Box>
  );
};
```

## クエリパラメータを使ったディープリンクの起動

ディープリンクのクエリパラメータを使うと、特定のオンボーディングステップを開いたり、データをあらかじめ入力したりできます。

```typescript
import type { ExtensionContextValue } from '@stripe/ui-extension-sdk/context';

const OnboardingView = ({ environment }: ExtensionContextValue) => {
  // Access query parameters from the deep link
  const { queryParams } = environment;

  // Pre-fill step from query parameter
  const initialStep = queryParams?.step ? parseInt(queryParams.step) : 1;

  // Pre-fill API key from query parameter (e.g., from Tajo dashboard)
  const prefilledApiKey = queryParams?.brevo_key || '';

  // Source tracking for analytics
  const installSource = queryParams?.source || 'marketplace';

  const [step, setStep] = useState(initialStep);
  const [brevoApiKey, setBrevoApiKey] = useState(prefilledApiKey);

  // ... rest of onboarding logic
};
```

オンボーディングのデータをあらかじめ入力するディープリンクを生成します。

```javascript
// From your Tajo dashboard, generate a link that pre-fills the Brevo API key
const onboardingLink = [
  'https://dashboard.stripe.com/live/acct_xxxxx/dashboard',
  '?apps[com.tajo.brevo-integration][modal]=stripe.dashboard.onboarding',
  '&apps[com.tajo.brevo-integration][queryParams][step]=1',
  '&apps[com.tajo.brevo-integration][queryParams][source]=tajo_dashboard',
].join('');
```

## 再訪ユーザーへの対応

オンボーディングを終えたユーザーがアプリを開いたときは、その状態を判定して適切なビューを表示します。

```typescript
const MainView = ({ environment, userContext }: ExtensionContextValue) => {
  const [authState, setAuthState] = useState<'loading' | 'signed-out' | 'onboarding' | 'ready'>('loading');

  useEffect(() => {
    checkUserState().then((state) => {
      setAuthState(state);
    });
  }, []);

  switch (authState) {
    case 'loading':
      return <Spinner label="Loading..." />;
    case 'signed-out':
      return <SignInView onSignInComplete={() => setAuthState('onboarding')} />;
    case 'onboarding':
      return <OnboardingView onComplete={() => setAuthState('ready')} />;
    case 'ready':
      return <DashboardView />;
  }
};
```

Tip

オンボーディングの完了状態は Stripe の Secret Store に保存しておくと、外部 API を呼び出さずに再訪ユーザーを判定できます。
