# Python -------------------------------------------------------------------------------- title: "はじめに" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/introduction/" service: "All Services" related: - プロジェクトディレクトリ構造 (/ja/cli/v1/project-directory-structure/introduction/) - AppSail用Catalyst SDK (/ja/serverless/help/appsail/implement-catalyst-sdk/) -------------------------------------------------------------------------------- # AppSailを使用したLead Managerアプリ ### はじめに このチュートリアルでは、**Lead Manager**と呼ばれる**Python Flask**アプリケーションWebアプリケーションの構築方法を説明します。このWebアプリを使用すると、[Zoho CRMアカウント](https://www.zoho.com/in/crm/)に接続し、組織のリードを管理できます。このアプリケーションから直接、CRMアカウントの[Leadsモジュール](https://help.zoho.com/portal/ja/kb/crm/sales-force-automation/leads)のリードにアクセス、追加、編集、削除できます。 Zoho CRMへの接続は、[OAuth 2.0認証プロトコル](https://docs.catalyst.zoho.com/ja/api/oauth2/overview-and-terminology/#OverviewandTerminology)を使用して確立されます。*Lead Manager*アプリケーション用の`OAuth Access Token`を生成し、CRMデータへのアクセス接続を認可するために使用します。このチュートリアルでの認証要件は、[Embedded Authentication](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/native-catalyst-authentication/embedded-authentication/introduction/)を使用して処理されます。 また、CRMアカウントへのアクセスを管理するために[Catalyst Connector](https://docs.catalyst.zoho.com/ja/sdk/java/v1/connectors/connectors/)を実装します。コネクタは、`Refresh Token`を使用して`Access Token`の有効期限が切れるたびに自動的に更新し、クライアントとCRMアカウント間の常時接続を維持します。 これらのトークンは、[Zoho APIコンソール](https://api-console.zoho.com/)にクライアントアプリケーションを登録し、必要な認証情報を取得した後に生成できます。 クライアントアプリケーションは以下のようになります: ![catalyst_tutorials_leadmanager_appsail_first_look](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_first_look.webp) Lead Managerアプリケーションは、以下のCatalystサービスのコンポーネントを使用します: - [**Catalyst Serverless**](https://docs.catalyst.zoho.com/ja/serverless/): - [AppSail](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/introduction/): 独立した*Python Flask*アプリケーションをホスティングします。アプリのフロントエンドとバックエンドロジックを構築し、それらをバンドルしてAppSailにデプロイします。 - [**Catalyst CloudScale**](https://docs.catalyst.zoho.com/ja/cloud-scale/): - [Data Store](https://docs.catalyst.zoho.com/ja/cloud-scale/help/data-store/introduction/): 関数リソースによって取得された`Refresh Token`と[CatalystユーザーのUserID](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/user-management/users/introduction/)を保存します。`Refresh Token`は、新しい`Access Token`を生成する必要があるたびに、関数によってこのテーブルから取得されます。 - [ZCQL](https://docs.catalyst.zoho.com/ja/cloud-scale/help/zcql/introduction/): クエリを通じて*Data Store*からデータを取得します。 - [Catalyst Authentication](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/introduction/): 標準のログインオプションに加えて、クライアントアプリケーションのログインページに[Zohoソーシャルログイン](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/social-logins/configuring-social-logins/#enable-zoho-social-login)を実装します。このチュートリアルでは[Embedded Authentication タイプ](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/native-catalyst-authentication/embedded-authentication/introduction/)を実装します。 このアプリケーションの構築には、[Catalyst Webコンソール](https://console.catalyst.zoho.com)と[Catalyst Command Line Interface](https://docs.catalyst.zoho.com/ja/cli/v1/cli-command-reference/)(CLI)を使用します。 > **Info:** このチュートリアルでは、関数およびクライアントコンポーネントに含めるファイルのコードが提供されます。提供されたコードをコピーして、指示に従って適切なファイルに貼り付けるだけで構いません。 ### アプリケーションアーキテクチャ Lead Managerアプリケーションのアーキテクチャを以下に示します: ![catalyst_tutorials_leadmnager_appsail_architecture_dig](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmnager_appsail_architecture_dig.webp) アプリケーションの全体的なワークフローは、[フロントエンドロジックのコーディング](https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/code-app)の際に詳しく説明します。手順を進めながらご確認ください。 -------------------------------------------------------------------------------- title: "前提条件" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/prerequisites/" service: "All Services" related: - Catalyst Tools VS Code Plugin (/ja/catalyst-extensions/vs-code-extension/introduction/) -------------------------------------------------------------------------------- # 前提条件 アプリケーションの構築を開始する前に、以下の前提条件がシステムにインストールされている必要があります: 1. **Catalyst CLI**: Catalyst CLIには、ローカルマシンからアプリケーションのコンポーネントを初期化、開発、テスト、デプロイするためのツールが含まれています。このチュートリアルではCatalyst CLIを使用します。以下のアクションを実行する必要があります: - **Catalyst CLIのインストール**: Catalyst CLIはNPMを通じてインストールされます。そのため、CLIをインストールする前にNPMとNode.jsがシステムにインストールされている必要があります。前提条件とインストール手順の詳細については、[**Catalyst CLIのインストールヘルプページ**](https://docs.catalyst.zoho.com/ja/getting-started/installing-catalyst-cli/)を参照してください。 - **Catalyst CLIへのログイン**: Catalyst CLIをインストールした後、使用する前にCatalystアカウントでCLIを認証する必要があります。Catalyst CLIからのログイン手順と利用可能なオプションについては、[**CLIログインヘルプページ**](https://docs.catalyst.zoho.com/ja/cli/v1/login/login-from-cli/)を参照してください。 2. **Zoho CRMアカウント**: LeadsモジュールはZoho CRMのすべてのエディションで利用できるため、Lead Managerアプリケーションとの接続を確立するには、任意のエディションのZoho CRMアカウントを使用できます。Zoho CRMアカウントをお持ちでない場合は、[こちら](https://www.zoho.com/in/crm/)からサインアップできます。 3. **Python 3.9のインストール**: CatalystはPython 3.9から3.13までのバージョンをサポートしています。このチュートリアルはPython 3.9を使用します。Python 3.9がシステムにインストールされていない場合は、この[ページ](https://www.python.org/downloads/release/python-3913/)からパッケージをダウンロードできます。 4. **PythonおよびクライアントコードのためのIDEツール** 関数とクライアントコードの作業には任意のIDEを使用できます。一般的な選択肢にはVisual Studio Code、PyCharm、IDLE、Sublime Textなどがあります。お好みのIDEをダウンロードしてシステムにインストールしてください。 > Visual Studio Code IDEをご利用の場合は、**Catalyst Tools**拡張機能をインストールし、CLIの代わりにIDEを使用できます。Catalyst VS Code拡張機能の詳細については、この[ヘルプセクション](https://docs.catalyst.zoho.com/ja/catalyst-extensions/vs-code-extension/introduction/)を参照してください。 -------------------------------------------------------------------------------- title: "プロジェクトの作成" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-11-03T15:16:51.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/create-project/" service: "All Services" related: - プロジェクトディレクトリ構造 (/ja/cli/v1/project-directory-structure/introduction/) - AppSail用Catalyst SDK (/ja/serverless/help/appsail/implement-catalyst-sdk/) -------------------------------------------------------------------------------- # プロジェクトの作成 Catalystコンソールから[Catalystプロジェクトを作成](https://docs.catalyst.zoho.com/ja/getting-started/catalyst-projects/#create-a-catalyst-project)しましょう。 1. [Catalystコンソール](https://console.catalyst.zoho.com/baas/index)にログインし、**Create New Project**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_create_proj](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_create_proj.webp) 2. ポップアップウィンドウにプロジェクト名として「**LeadManager**」と入力します。 ![catalyst_tutorials_leadmanage_appsail_proj_name](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanage_appsail_proj_name.webp) プロジェクトが作成されます。**Access Project**をクリックしてプロジェクトを開くことができます。 ![catalyst_tutorials_leradmanager_appsail_access_proj](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leradmanager_appsail_access_proj.webp) -------------------------------------------------------------------------------- title: "テーブルの作成" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/create-table/" service: "All Services" related: - Data Store (/ja/cloud-scale/help/data-store/introduction/) - ZCQL (/ja/cloud-scale/help/zcql/introduction) -------------------------------------------------------------------------------- # テーブルの作成 次に、**Data Store**にテーブルを作成しましょう。このテーブルは、*Access Token*を生成する必要があるたびに取得される*Refresh Token*と`userID`の値を保存するために使用されます。 テーブルを作成するには: 1. コンソールの[Catalyst CloudScale](https://docs.catalyst.zoho.com/ja/cloud-scale/)サービスセクションに移動し、**Start Exploring**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_start_explore_cloud_scale](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_start_explore_cloud_scale.webp) 2. **Create a new Table**をクリックします。 ![catalyst_tutorials_lkeadmanager_appsail_create_table](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/data-store-create-new-table.webp) 3. テーブル名として「`Token`」と入力し、**Create**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_table_nme](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_table_nme.webp) > **Note:** アプリケーションのコードに同じ名前が含まれているため、指示通りに正確に名前を入力してください。 テーブルが作成されます。 ![catalyst_tutorials_leadmnager_appsail_table_created](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmnager_appsail_table_created.webp) 次に、`userID`と`refresh token`をそれぞれ保存するための2つのカラムをテーブルに作成しましょう。 > **Info:** Catalystがサポートするさまざまなデータ型やカラムのその他のプロパティについては、[Data Storeヘルプドキュメント](https://docs.catalyst.zoho.com/ja/cloud-scale/help/data-store/introduction/)で確認できます。 4. *Schema View*セクションの**New Column**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_new_clm](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_new_clm.webp) 5. カラム名として「refresh_token」と入力します。データ型としてEncrypted Textを選択します。 ![catalyst_tutorials_leadmanager_appsail_clm_name](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_clm_name.webp) 6. **Create**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_clm_1_created](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_clm_1_created.webp) 7. 再度**New Column**ボタンをクリックして2番目のカラムを作成します。名前を「`userId`」とし、データ型として**BigInt**を選択します。 ![catalyst_tutorials_leadmanager_appsail_clm_2](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_clm_2.webp) 8. **Create**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_clms_created](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_clms_created.webp) 必要なカラムが作成されました。 ### スコープと権限の設定 Lead Managerアプリケーションの任意のユーザーがクライアントアプリケーションからリードを表示または管理できるようにするには、必要に応じてユーザーが新しい*Refresh Token*を取得および保存できるようにする追加の[テーブル権限](https://docs.catalyst.zoho.com/ja/cloud-scale/help/data-store/scopes-and-permissions)を有効にする必要があります。 必要な権限を有効にするには: 1. **Scopes and Permissions**タブをクリックします。 ![catalyst_tutorials_leadmanager_appsail_tables_permissions](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_tables_permissions.webp) 2. *Table Permissions*セクションの**App User**ロールに対して**Insert**権限を有効にします。他の権限設定は変更しないでください。 ![catalyst_tutorials_leadmanager_appsail_permission_aet](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_permission_aet.webp) Data Storeコンポーネントがアプリケーション用に設定されました。 -------------------------------------------------------------------------------- title: "Zohoソーシャルログインの有効化" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-08-17T12:16:04.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/enable-auth/" service: "All Services" related: - 認証 (/ja/cloud-scale/help/authentication/introduction/) - 埋め込み認証 (/ja/cloud-scale/help/authentication/native-catalyst-authentication/embedded-authentication/introduction/) - ソーシャルログインの有効化 (/ja/cloud-scale/help/authentication/social-logins/configuring-social-logins/) - パブリックサインアップ (/ja/cloud-scale/help/authentication/public-signup/) -------------------------------------------------------------------------------- # Embedded Authenticationを使用したZohoソーシャルログインの有効化 Lead Managerアプリケーションには、Zoho CRMアカウントにアクセスするために有効な認証情報を入力する必要があるログインページがあります。 このアプリケーションにサインアップ機能を実装する必要があります。この機能は、[Zoho Social Logins](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/social-logins/configuring-social-logins/#enable-zoho-social-login)を使用してアカウントにログインするオプションも提供する必要があります。この要件を満たすために、[Embedded Authentication タイプ](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/native-catalyst-authentication/embedded-authentication/introduction/)を実装します。 コンソールからLead ManagerアプリケーションのZohoソーシャルログインを設定するには: 1. *Security & Identity*セクションの**Authentication**コンポーネントに移動し、**Native Catalyst Authentication**タブの**Setup**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_native_auth_setup](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/lead-manager-appsail-authentication.webp) 2. **Embedded Authentication**を選択し、**Next**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_embed_sel_auth](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_embed_sel_auth.webp) 3. **Configuration**ステップで提供されたスクリプトをコピーして使用し、ログイン機能を設定できます。ただし、*Zohoソーシャルログイン*のみを使用するため、まず**Public Signup toggle**を有効にする必要があります。 ![catalyst_tutorials_leadmanager_appsail_enable_public_signup](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_enable_public_signup.webp) 4. ダイアログボックスの内容を確認した後、**Yes, Proceed**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_public_sign_popup](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_public_sign_popup.webp) 5. **Zoho**ボタンをクリックしてソーシャルログインを有効にします。 ![catalyst_tutorials_leadmanager_appsail_start_social](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_start_social.webp) 6. *Client Name*として「`LeadManagerApp`」を入力し、**Enable**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_zoho_enabling_client](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_zoho_enabling_client.webp) 7. **Next**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_social_enabled_zoho_on](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_social_enabled_zoho_on.webp) 8. このアプリケーションでは追加の認証設定は行いません。**Finish**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_skip_step_fin](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_skip_step_fin.webp) アプリケーションで**Embedded Authentication**が有効になり、ユーザーは**Zohoソーシャルログイン**を使用してアプリにログインできるようになりました。 ![catalyst_tutorials_leadmanager_appsail_auth_zoho_enabled_cmpltd](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_auth_zoho_enabled_cmpltd.webp) -------------------------------------------------------------------------------- title: "プロジェクトの初期化" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-10-30T17:47:18.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/init-project/" service: "All Services" related: - Catalyst CLI (/ja/cli/v1/cli-command-reference/) - リソースの初期化 (/ja/cli/v1/initialize-resources/introduction/) - Catalyst AppSail Help (/ja/serverless/help/appsail/introduction/) - プロジェクトディレクトリ (/ja/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # プロジェクトの初期化 CLIからCatalystプロジェクトの作業を開始できます。最初のステップは、空のディレクトリでプロジェクトを初期化することです。これがプロジェクトのホームディレクトリとなり、すべてのプロジェクトファイルがここに保存されます。 詳細については、[プロジェクトディレクトリ構造のヘルプページ](https://docs.catalyst.zoho.com/ja/cli/v1/project-directory-structure/introduction/)を参照してください。プロジェクトの初期化の詳細については、[CLIヘルプドキュメント](https://docs.catalyst.zoho.com/ja/cli/v1/initialize-resources/introduction/)を参照してください。 このアプリケーションでは、[AppSail](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/introduction/)コンポーネントのみを初期化します。*AppSail*コンポーネントは**Node.js**プログラミングスタックで初期化されます。 1. ローカルマシンにプロジェクト用のフォルダを作成し、ターミナルからそのフォルダに移動します。 2. そのディレクトリから以下のコマンドを実行してプロジェクトを初期化します: ```sh catalyst init ``` 3. **矢印キー**を使用して移動し、希望するポータルを選択して**Enter**をクリックします。アカウントに他の組織が関連付けられていない場合は、デフォルトが自動的に選択されます。 ![catalyst_tutorials_leadmanager_appsail_catalyst_init](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_catalyst_init.webp) > **Info:** Catalystのマルチ組織ポータル機能の詳細については、この[ヘルプドキュメント](https://docs.catalyst.zoho.com/ja/getting-started/catalyst-organizations/#access-the-multi-org-portal)を参照してください。 4. CLIはディレクトリにCatalystプロジェクトを関連付けるよう求めます。コンソールから先ほど作成したプロジェクトと関連付けます。リストから**LeadManager**を選択し、**Enter**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_cli_proj_sel](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_cli_proj_sel.webp) 5. スペースバーを使用して**AppSail**を選択し、**Enter**をクリックして初期化します。 ![catalyst_tutorials_leadmanager_appsail_sel_appsail](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_sel_appsail.webp) 6. CLIは[Catalyst-Managed Runtime](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/catalyst-managed-runtimes/key-concepts/)と[Docker Image](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/custom-runtimes/container-registry-services/)のどちらかを選択するよう求めます。Catalyst-Managed Runtimeからプロジェクトを作成するため、**Catalyst-Managed Runtime**を選択して**Enter**をクリックします。 ![catalyst_alien_city_cli_appsail_setup_start](https://catalyst-docs-development.zohostratus.in/images/tutorials/alien-city-appsail-express/aliencity-appsail-selection.webp) 7. CLIが*AppSail*サービスを開始します。 - 独自のプロジェクトを作成するため、推奨プロジェクトの一覧から始めるかどうかを尋ねるプロンプトに「`n`」と入力して**Enter**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_appsail_start_cli](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_appsail_start_cli.webp) - 現在のディレクトリで*AppSail*サービスを初期化するプロンプトに「`Y`」と入力します。 ![catalyst_tutorials_leadmanager_appsail_appsail_process_cli](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_appsail_process_cli.webp) 8. AppSailサービスの名前として「`LeadManagerApp`」を入力し、プロジェクトディレクトリパスをAppSailサービスのビルドパスとして入力します。 ![catalyst_tutorials_leadmanager_appsail_springboot_appsail_nme](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_springboot_appsail_nme.webp) 9. プログラミングスタックとして**Python**の最新ランタイムを選択し、**Enter**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_python_py_choice](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_py_choice.webp) Lead ManagerアプリケーションのAppSailサービスが初期化されました。 ![catalyst_tutorials_leadmanager_appsail_python_appsail_init_cmpltd](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_appsail_init_cmpltd.webp) ディレクトリは標準構造で作成され、AppSailサービスの設定を含む[`app-config.json`](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/catalyst-managed-runtimes/key-concepts/#app-configjsonファイル)ファイルと、[`catalyst.json`](https://docs.catalyst.zoho.com/ja/cli/v1/project-directory-structure/catalyst-json/)ファイルや隠しファイル`.catalystrc`などの標準プロジェクト設定ファイルが格納されます。 以下は、*AppSail*サービスで初期化された**LeadManager**プロジェクトのディレクトリ構造です。 ![catalyst_tutorials_leadmanager_appsail_python_pre_setup](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_pre_setup.webp) ### アプリケーションのデプロイ 必要な**アプリケーションURL**を取得するために、アプリケーションをコンソールにデプロイする必要があります。このURLは、必要な`Client ID`と`Client Secret`の値を取得するために[Zoho APIコンソール](https://api-console.zoho.com/)にクライアントを登録する際に必要です。 > **Info:** コーディングが完了し、`Client ID`と`Client Secret`の値をアプリケーションに追加した後、アプリケーションサービスを再デプロイします。 以下のCLIコマンドを入力してアプリケーションをデプロイします: ```sh catalyst deploy ``` 次に、アプリケーションURLを取得するには: 1. コンソールの**Catalyst Serverless**セクションの*COMPUTE*セクションにある[AppSail](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/introduction/)コンポーネントに移動します。 ![catalyst_tutorials_leadmanager_appsail_python_service_listing](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_service_listing.webp) アプリケーションがAppSailサービスとしてデプロイされていることを確認できます。 2. AppSailサービスをクリックすると、アプリケーションURLを確認できます。 ![catalyst_tutorials_leadmanager_appsail_python_appsail_url](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_appsail_url.webp) > **Info:** `catalyst deploy` CLIコマンドとAppSailサービスの詳細については、チュートリアルの最後でアプリケーションを再デプロイした後に説明します。 ### 追加フォルダとファイルの作成 クライアントコードを保存するために、ルートディレクトリに2つのフォルダを作成する必要があります: * `static`: アプリケーションの完成に必要なJSおよびCSSスクリプトを格納します * `templates`: アプリのHTMLコードを格納します また、以下のコマンドを実行して「**main.py**」コードファイルを作成する必要があります。 ```sh touch main.py ``` このファイルはバックエンドコードの保存に使用されます。 以下は、LeadManagerプロジェクトのディレクトリの現在の構造です: ![catalyst_tutorials_leadmanager_appsail_python_current_dir](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_current_dir.webp) -------------------------------------------------------------------------------- title: "クライアントの登録" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-08-17T12:16:04.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/register-client/" service: "All Services" related: - Catalyst Authentication (/ja/cloud-scale/help/authentication/introduction/) - ソーシャルログイン (/ja/cloud-scale/help/authentication/social-logins/introduction/) -------------------------------------------------------------------------------- # クライアントの登録 次に、[Zoho APIコンソール](https://api-console.zoho.com/)でクライアントアプリケーションを登録し、以下の認証情報を生成する必要があります: - `Client ID`:登録されたクライアントに対して生成される一意のキー - `Client Secret`:登録されたクライアントの`Client ID`に対して生成されるシークレット値 `Client ID`と`Client Secret`は、バックエンドおよびフロントエンドのコードの複数の箇所に追加されます。これらの値は、最初に`Access Token`と`Refresh Token`を生成するために必要であり、その後`Refresh Token`を使用して`Access Token`を更新するためにも必要です。 Zoho APIコンソールでクライアントアプリケーションを登録するには: 1. [Zoho APIコンソール](https://api-console.zoho.com/)にアクセスし、**Get Started**をクリックします。 ![catalyst_tutorials_lead_manager_appsail_api_console_start](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_lead_manager_appsail_api_console_start.webp) 2. クライアントタイプとして**Server-based Applications**を選択します。 ![catalyst_tutorials_leadmnager_appsail_appsail_api_console_client_sel](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmnager_appsail_appsail_api_console_client_sel.webp) 3. **Client Name**に「`LeadManagerApp」`と入力します。 ![catalyst_tutorials_leadmanager_appsail_api_console_client_nme](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_api_console_client_nme.webp) 4. 以下の形式でその他の詳細を入力します: - Homepage URL: **AppSailアプリケーションURL** - Authorized Redirect URIs: **AppSailアプリケーションURL/generateToken** ![catalyst_tutorials_leadmanager_appsail_adding_first_api_console_uri](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_adding_first_api_console_uri.webp) {**AppSailアプリケーションURL**}を、この[ステップ](https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/init-project/#deploy-the-application)で先ほどプロジェクトをデプロイした際に取得したアプリケーションURLに置き換えてください。 5. クライアントに別の**Authorized Redirect URI**を追加する必要があります。コードの設定後にアプリを**localhost**を通じてテストするためにサーブします。ローカルドメインにリダイレクトされるため、別のAuthorized Redirect URIとして追加する必要があります。 ![catalyst_tutorials_leadmanager_appsail_apiconsole_register_client_uris](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_apiconsole_register_client_uris.webp) > **Info:** CLIからアプリケーションをローカルでサーブする場合、ポートが他で使用されていない限り、デフォルトで`port 3000`からホストされます。そのため、それに応じてドメインを追加してください。 6. **Create**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_client_id_client_scrt](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_client_id_client_scrt.webp) APIコンソールが、登録されたクライアントの`Client ID`と`Client Secret`の値を生成して表示します。 これらの値をコピーして、アプリケーションのフロントエンドおよびバックエンドのコードに貼り付ける必要があります。これについては、以降のセクションで説明します。 -------------------------------------------------------------------------------- title: "依存関係のインストール" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-10-30T17:47:18.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/init-dependencies/" service: "All Services" related: - Python SDK (/ja/sdk/python/v1/overview/) -------------------------------------------------------------------------------- # Flaskと必要な依存関係を仮想環境にインストールする このPython Flaskアプリを使用するには、システムに仮想環境を作成する必要があります。 ターミナルで以下のコマンドを実行して仮想環境を作成できます。 **Linux/Macユーザー向け** ```sh python3.9 -m venv myenv ``` ```sh source myenv/bin/activate ``` **Windowsユーザー向け** ```sh python3.9 -m venv myenv ``` ```sh myenv\Scripts\activate ``` ![catalyst_tutorials_leadmanager_appsail_python_virtual_env](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_virtual_env.webp) 作成した仮想環境で、以下のCLIコマンドを実行して**Flask**と必要な[Catalyst SDK](https://docs.catalyst.zoho.com/ja/sdk/python/v1/overview/)をインストールします。 ```sh python3 -m pip install zcatalyst-sdk ``` ![catalyst_tutorials_leadmanager_appsail_python_pip_install](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_pip_install.webp) > **Note:** AppSail向けのCatalyst SDKについての詳細は、この[ヘルプドキュメント](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/implement-catalyst-sdk/)をご参照ください。 パッケージのインストール後、プロジェクトディレクトリは以下のようになります: ![catalyst_tutorials_leadmanager_appsail_dir_view_post_pip](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_dir_view_post_pip.webp) Python Flaskアプリケーションに必要なすべてのパッケージがインストールされました。 -------------------------------------------------------------------------------- title: "アプリケーションのコーディング" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-09-02T06:22:26.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/code-app/" service: "All Services" related: - 認証用Web SDK (/ja/sdk/web/v4/cloud-scale/authentication/get-auth-instance/) -------------------------------------------------------------------------------- # アプリケーションのコーディング アプリケーションのコーディングを始めましょう。 アプリケーションのバックエンドロジックは、`LeadManager/`ディレクトリ内の`main.py`ファイルにコーディングします。 コードのフロントエンドは以下のように保存されます: * `LeadManager/templates/`ディレクトリに、以下のファイルを作成します: - `index.html`:アプリケーションのフロントエンドのHTMLコードを含みます。 - `login.html`:アプリケーションの[Embedded Authentication](https://docs.catalyst.zoho.com/ja/cloud-scale/help/authentication/native-catalyst-authentication/embedded-authentication/introduction/)を有効にするHTMLコードを含みます。 * `LeadManager/static/`ディレクトリに、以下のファイルを作成します: - `main.css`:アプリに必要なスタイリング要素を含みます。 - `main.js`:フロントエンドとバックエンドを接続するJavaScriptコードを含みます。 以下がLeadManagerプロジェクトの最終的なフォルダ構造です: ![catalyst_tutorials_leadmanager_appsail_flask_final_dir](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_flask_final_dir.webp) `main.py`、`index.html`、`login.html`、`main.css`、および`main.js`ファイルをコーディングします。また、`app-config.json`ファイルも更新します。 > **Note:** このセクションのコードを十分に理解するために、コードをよく確認してください。 以下のコードをコピーして、IDEを使用してプロジェクトのそれぞれのファイルに貼り付けて保存してください。 **main.py** ```python import sys sys.path.insert(0, './myenv/lib/python3.9/site-packages') from flask import Flask, request, jsonify, make_response, redirect import os import json import logging import requests from flask.templating import render_template import zcatalyst_sdk app = Flask(__name__, static_url_path='/', static_folder='static', template_folder='templates') API_BASE = "https://www.zohoapis.com/crm/v2" LEADS_URL = f"{API_BASE}/Leads" TOKEN_URL = "https://accounts.zoho.com/oauth/v2/token" # 環境変数から認証情報を読み込みます。シークレットをソースコードに直接記述しないでください。 CLIENT_ID = os.environ.get('ZOHO_CLIENT_ID') CLIENT_SECRET = os.environ.get('ZOHO_CLIENT_SECRET') logger = logging.getLogger() def is_valid_record_id(record_id): return isinstance(record_id, str) and record_id.isdigit() @app.route('/') def index(): return render_template('index.html') @app.route('/index.html') def indexhtml(): return render_template('index.html') @app.route('/login.html') def login(): return render_template('login.html') @app.route('/generateToken', methods=['GET']) def generateToken(): try: catalyst_app = zcatalyst_sdk.initialize(req=request) user_management_service = catalyst_app.authentication() datastore = catalyst_app.datastore() code = request.args.get('code') user_details = user_management_service.get_current_user() user_id = user_details["user_id"] is_local = os.getenv('X_ZOHO_CATALYST_IS_LOCAL') == 'true' protocol = 'http' if is_local else 'https' host = request.headers['host'] if is_local else request.headers['host'].split(':')[0] domain = f"{protocol}://{host}" logger.info(f'domain:{domain}') tab = datastore.table('2113000000078743') #Table IDに置き換えてください refresh_token = getRefreshToken(code, domain) logger.info('refresh_token retrieved successfully') # トークンの値はログに出力しないでください row = {"refresh_token": refresh_token, "userId": user_id} tab.insert_row(row) redirect_uri = f"{domain}/index.html" return redirect(redirect_uri) except Exception as err: logger.error(f'Error on generateToken: {err}') return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) @app.route('/getUserDetails', methods=['GET']) def userDetails(): try: catalyst_app = zcatalyst_sdk.initialize(req=request) user_details = getUserId(catalyst_app) if len(user_details) != 0: user_id = user_details[0]["Token"]["userId"] else: user_id = None return make_response({"userId": user_id}, 200) except Exception as err: logger.error(f'Error on getUserDetails: {err}') return make_response({ "message": "Internal Server Error in getting user details. Please try again after sometime." }, 500) @app.route('/crmData', methods=['GET']) def crmData(): try: catalyst_app = zcatalyst_sdk.initialize(req=request) user_details = getUserId(catalyst_app) access_token = getAccessToken(user_details, catalyst_app) headers = { 'Authorization': f'Zoho-oauthtoken {access_token}', "Content-Type": "application/json" } api_response = requests.get(LEADS_URL, headers=headers) return make_response(jsonify(api_response.json()), 200) except Exception as err: logger.error(err) return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) @app.route('/crmData', methods=['POST']) def postcrmData(): try: catalyst_app = zcatalyst_sdk.initialize(req=request) data = {"data": [json.loads(request.data)]} user_details = getUserId(catalyst_app) access_token = getAccessToken(user_details, catalyst_app) headers = { 'Authorization': f'Zoho-oauthtoken {access_token}', "Content-Type": "application/json" } api_response = requests.post(LEADS_URL, headers=headers, json=data) if api_response.status_code in (200, 201): return make_response(api_response.json(), 200) logger.error(api_response.json()) return make_response(api_response.json(), 500) except Exception as err: logger.error(err) return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) @app.route('/crmData/<id>', methods=['GET']) def getCRMData(id): if not is_valid_record_id(id): return make_response({"message": "Invalid record ID"}, 400) try: catalyst_app = zcatalyst_sdk.initialize(req=request) user_details = getUserId(catalyst_app) access_token = getAccessToken(user_details, catalyst_app) headers = { 'Authorization': f'Zoho-oauthtoken {access_token}', "Content-Type": "application/json" } api_response = requests.get(f"{LEADS_URL}/{id}", headers=headers) return make_response(api_response.json(), 200) except Exception as err: logger.error(err) return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) @app.route('/crmData/<id>', methods=['PUT']) def putcrmData(id): if not is_valid_record_id(id): return make_response({"message": "Invalid record ID"}, 400) try: catalyst_app = zcatalyst_sdk.initialize(req=request) req_data = request.get_json() if req_data is None: return make_response({"message": "Update data not found"}, 400) data = {"data": [req_data]} user_details = getUserId(catalyst_app) access_token = getAccessToken(user_details, catalyst_app) headers = { 'Authorization': f'Zoho-oauthtoken {access_token}', "Content-Type": "application/json" } api_response = requests.put(f"{LEADS_URL}/{id}", headers=headers, json=data) return make_response(api_response.json(), 200) except Exception as err: logger.error(err) return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) @app.route('/crmData/<id>', methods=['DELETE']) def deletelead(id): if not is_valid_record_id(id): return make_response({"message": "Invalid record ID"}, 400) try: catalyst_app = zcatalyst_sdk.initialize(req=request) user_details = getUserId(catalyst_app) access_token = getAccessToken(user_details, catalyst_app) headers = { 'Authorization': f'Zoho-oauthtoken {access_token}', "Content-Type": "application/json" } api_response = requests.delete(f"{LEADS_URL}/{id}", headers=headers) return make_response(api_response.json(), 200) except Exception as err: logger.error(err) return make_response({ "message": "Internal Server Error. Please try again after sometime." }, 500) def getRefreshToken(code, domain): if not code: raise ValueError("Authorization 'code' is missing from the request") if not CLIENT_ID or not CLIENT_SECRET: raise ValueError("ZOHO_CLIENT_ID / ZOHO_CLIENT_SECRET environment variables are not set") params = { 'code': code, 'client_id': CLIENT_ID, 'client_secret': CLIENT_SECRET, 'grant_type': 'authorization_code', 'redirect_uri': f"{domain}/generateToken" } response = requests.post(TOKEN_URL, params=params) try: data = response.json() except ValueError: logger.error(f'Token endpoint returned non-JSON (status {response.status_code}): {response.text}') raise if 'refresh_token' not in data: logger.error(f'Token exchange failed: {data}') raise ValueError(data.get('error', 'refresh_token not returned by token endpoint')) return data['refresh_token'] def getAccessToken(userdetails, catalyst_app): user_id = userdetails[0]['Token']['userId'] zcql = catalyst_app.zcql() query = f"Select refresh_token FROM Token where userId={user_id}" response = zcql.execute_query(query) refresh_token = response[0]['Token']['refresh_token'] args = { "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, "auth_url": TOKEN_URL, "refresh_url": TOKEN_URL, "refresh_token": refresh_token, } connector_service = catalyst_app.connection({user_id: args}) access_token = connector_service.get_connector(user_id).get_access_token() return access_token def getUserId(catalyst_app): user = catalyst_app.authentication().get_current_user() user_id = user["user_id"] return catalyst_app.zcql().execute_query( f"Select * from Token where userId = {user_id}" ) if __name__ == '__main__': port = int(os.environ.get('X_ZOHO_CATALYST_LISTEN_PORT', 9000)) app.run(host='0.0.0.0', port=port) ``` > **Note:** * Zoho APIコンソールでクライアントを登録した後に取得した`Client ID`と`Client Secret`の値は、`ZOHO_CLIENT_ID`および`ZOHO_CLIENT_SECRET`環境変数から読み込まれます。これらの値はソースファイルに直接記述せず、AppSailアプリケーションの環境変数として設定してください。 * *Data Store*で作成したテーブルの`Table ID`を**57**行目に追加してください。 **index.html** ```xml <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>CRM Lead Manager</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.19.1/css/mdb.min.css" rel="stylesheet"> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"> </script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"> </script> <script src="main.js"> </script> <script src="https://static.zohocdn.com/catalyst/sdk/js/4.6.2/catalystWebSDK.js"> </script> <script src="/__catalyst/sdk/init.js"> </script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <style> #connect { height: 260px; width: 500px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; } </style> </head> <body onload="getUserDetails()"> <br> <center> <h1>CRM Lead Manager</h1> <br> </center> <div id="connect"> <center> <p>Click here to connect to Zoho CRM</p> <button onclick='navigate()'> <img src="https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/icon-crm_blue.png" style="width: 180px;height: 130px;"> </button> </center> </div> <div style="width: 200px;float: right; margin-right: 30px;"> <label for="logoutbtn" class="btn btn-success btn-block btn-outlined">Logout</label> <button id="logoutbtn" onclick="logout()" style="display: none;"> </button> </div> <div id="main"> <div class="container"> <ul class="nav nav-tabs nav-justified mb-3" id="myTab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="check-tab" data-toggle="tab" href="#check" role="tab" aria-controls="check" aria-selected="true">Add a Lead</a> </li> <li class="nav-item"> <a class="nav-link" id="report-tab" data-toggle="tab" href="#report" onclick="getLeads()" role="tab" aria-controls="report" aria-selected="false">Manage Leads</a> </li> </ul> <br> <div class="tab-content" id="myTabContent"> <div class="tab-pane fade show active" id="check" role="tabpanel" aria-labelledby="check-tab"> <div class="tab-pane fade show active" id="ex3-tabs-1" role="tabpanel" aria-labelledby="ex3-tab-1"> <div style="margin-left: 100px; margin-right:100px;"> <form id="leads"> <!-- 2 column grid layout with text inputs for the first and last names --> <div class="row mb-4"> <div class="col"> <div class="form-outline"> <label class="form-label" for="form6Example1">First name</label> <input type="text" id="firstName" class="form-control" /> </div> </div> <div class="col"> <div class="form-outline"> <label class="form-label" for="form6Example2">Last name</label> <input type="text" id="lastName" class="form-control" required /> </div> </div> </div> <!-- Text input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example3">Company name</label> <input type="text" id="companyName" class="form-control" /> </div> <!-- Email input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example5">Email</label> <input type="email" id="email" class="form-control" /> </div> <!-- Text input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example4">State</label> <input type="text" id="state" class="form-control" /> </div> <!-- Number input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example6">Phone</label> <input type="number" id="phone" class="form-control" /> </div> <!-- Number input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example6">Lead Source</label> <input type="text" id="leadSource" class="form-control" /> </div> <!-- Submit button --> <center> <button type="submit" onclick="createLead();return false;" class="btn btn-primary btn-block mb-4" style="width: 100px;">Add Lead</button> <div id="loader" style="display: none;"> <div class="spinner-border" role="status"> <span class="sr-only">Loading...</span> </div> </div> </center> </form> </div> </div> </div> <div class="tab-pane fade" id="report" role="tabpanel" aria-labelledby="report-tab"> <center> <div id="loaders" style="display: none; padding-top: 200px;"> <div class="spinner-border" role="status"> <span class="sr-only">Loading...</span> </div> </div> </center> <p id="showData"> </p> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="vertical-alignment-helper"> <div class="modal-dialog vertical-align-center"> <div class="modal-content"> <center> <h4 class="modal-title" id="myModalLabel"> </h4> <div class="modal-body" id="message"> </div> <div class="modal-footer"> <button type="button" style="background-color: #007bff;color: white;" class="btn btn-default" data-dismiss="modal">Close</button> </div> </center> </div> </div> </div> </div> <div class="modal fade" id="editForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="vertical-alignment-helper"> <div class="modal-dialog vertical-align-center"> <div class="modal-content"> <div style="margin-left: 80px; margin-right:80px;"> <br> <center> <h2>Edit Lead</h2> </center> <br> <form id="editLeads"> <!-- 2 column grid layout with text inputs for the first and last names --> <div class="row mb-4"> <div class="col"> <div class="form-outline"> <label class="form-label" for="form6Example1">First name</label> <input type="text" id="editfirstName" class="form-control" /> </div> </div> <div class="col"> <div class="form-outline"> <label class="form-label" for="form6Example2">Last name</label> <input type="text" id="editlastName" class="form-control" required /> </div> </div> </div> <!-- Text input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example3">Company name</label> <input type="text" id="editcompanyName" class="form-control" /> </div> <!-- Email input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example5">Email</label> <input type="email" id="editemail" class="form-control" /> </div> <!-- Text input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example4">State</label> <input type="text" id="editstate" class="form-control" /> </div> <!-- Number input --> <div class="form-outline mb-4"> <label class="form-label" for="form6Example6">Phone</label> <input type="number" id="editphone" class="form-control" /> </div> <!-- Submit button --> <center> <button type="submit" id="editBtn" onclick="editLead();return false;" class="btn btn-primary btn-block mb-4" style="width: 100px;">Edit</button> <div id="loader" style="display: none;"> <div class="spinner-border" role="status"> <span class="sr-only">Loading...</span> </div> </div> </center> </form> </div> </div> </div> </div> </div> <div class="modal fade right" id="ModalDanger" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-notify modal-danger modal-side modal-top-right" role="document"> <!--Content--> <div class="modal-content"> <!--Header--> <div class="modal-header"> <p class="heading">Lead Deletion</p> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true" class="white-text">×</span> </button> </div> <!--Body--> <div class="modal-body"> <div class="row"> <div class="col-9"> <p>Are you sure you want to delete the Lead?</p> </div> </div> </div> <!--Footer--> <div class="modal-footer justify-content-center"> <a type="button" class="btn btn-danger" id="delete-btn" onclick="deleteLead()">Delete</a> <a type="button" class="btn btn-outline-danger waves-effect" data-dismiss="modal">Cancel</a> </div> </div> <!--/.Content--> </div> </div> </div> </body> <script> //クライアントIDを追加する function navigate() { window.location.href = "https://accounts.zoho.com/oauth/v2/auth?scope=ZohoCRM.modules.ALL&client_id={{client_id}}&response_type=code&access_type=offline&redirect_uri=" + location.protocol + '//' + location.host + "/generateToken"; } </script> </html> ``` > **Note:** **252**行目に`Client ID`を入力してください。 **login.html** ```xml <html> </html> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>CRM Lead Manager</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> <script src="main.js"> </script> <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <script src="https://static.zohocdn.com/catalyst/sdk/js/4.6.2/catalystWebSDK.js"> </script> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"> </script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"> </script> <script src="https://static.zohocdn.com/catalyst/sdk/js/4.6.2/catalystWebSDK.js"> </script> <script src="/__catalyst/sdk/init.js"> </script> <script> catalyst.auth.signIn("login"); </script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <style> #login { height: 100%; width: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; } </style> <body> <br> <center> <h1>CRM Lead Manager</h1> </center> <div id="login"> </div> </body> </html> ``` **main.css** ```css #dataTable { font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; } #dataTable td, #dataTable th { border: 1px solid #ddd; padding: 8px; } #dataTable tr:nth-child(even){background-color: #f2f2f2;} #dataTable tr:hover {background-color: #ddd;} #dataTable th { padding-top: 12px; padding-bottom: 12px; text-align: left; background-color: #007bff; color: white; } .vertical-alignment-helper { display: table; height: 100%; width: 100%; pointer-events: none; } .vertical-align-center { display: table-cell; vertical-align: middle; pointer-events: none; } .modal-content { width: inherit; max-width: inherit; height: inherit; margin: 0 auto; pointer-events: all; } ``` **main.js** ```javascript function createLead() { debugger; $("#loader").show(); var firstName = $("#firstName").val(); var lastName = $("#lastName").val(); if (lastName == "") { alert("Kindly Enter the Last Name"); $("#loader").hide(); return; } var companyName = $("#companyName").val(); var email = $("#email").val(); var state = $("#state").val(); var phone = $("#phone").val(); var leadSource = $("#leadSource").val(); $.ajax({ url: "/crmData", type: "post", contentType: "application/json", data: JSON.stringify({ "First_Name": firstName, "Last_Name": lastName, "Company": companyName, "Email": email, "State": state, "Phone": phone, "Lead_Source": leadSource, }), success: function (data) { debugger; $('#leads').trigger("reset"); $("#myModalLabel").html("Success"); $("#message").html("Lead Created Successfully"); $("#loader").hide(); $('#myModal').modal('show'); }, error: function (error) { $('#leads').trigger("reset"); $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); } function logout() { var redirectURL = "/login.html"; //Add your app domain var auth = catalyst.auth; auth.signOut(redirectURL); } function getUserDetails() { $("#main").hide(); $("#connect").hide(); catalyst.auth.isUserAuthenticated().then(result => { console.log(result) $("#loader").show(); $.ajax({ url: "/getUserDetails", type: "get", success: function (data) { $("#loader").hide(); if (data.userId) { $("#main").show(); $("#connect").hide(); } else { $("#connect").show(); $("#main").hide(); } }, error: function (error) { $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); }).catch(err => { document.body.innerHTML = 'You are not logged in. Please log in to continue. Redirecting you to the login page..'; setTimeout(function () { window.location.href = "login.html"; }, 3000); }); } function getLeads() { debugger; var tableContainer = document.getElementById("showData"); tableContainer.innerHTML = ""; $("#loaders").show(); $.ajax({ url: "/crmData", type: "get", success: function (data) { debugger; var reqData = getRequiredData(data.data); $("#loaders").hide(); renderTable(reqData); }, error: function (error) { $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); } function showDeletePopup(leadID) { $('#ModalDanger').modal('show'); var deleteBtn = document.getElementById("delete-btn"); deleteBtn.value = leadID; } function deleteLead() { var leadID = document.getElementById('delete-btn').value; $.ajax({ url: "/crmData/" + leadID, type: "delete", success: function (data) { debugger; $('#ModalDanger').modal('toggle'); $("#myModalLabel").html("Success"); $("#message").html("Lead Deleted Successfully"); $('#myModal').modal('show'); setTimeout(function () { location.reload(); }, 3000); }, error: function (error) { $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); } function showEditPopup(leadID) { $.ajax({ url: "/crmData/" + leadID, type: "get", success: function (data) { debugger; var respData = data.data; $('#editfirstName').val(respData[0].First_Name); $('#editlastName').val(respData[0].Last_Name); $('#editcompanyName').val(respData[0].Company); $('#editemail').val(respData[0].Email); $('#editstate').val(respData[0].State); $('#editphone').val(respData[0].Phone); $('#editleadSource').val(respData[0].Lead_Source); $('#editBtn').val(respData[0].id); $('#editfirstName').html(respData[0].First_Name); $('#editlastName').html(respData[0].Last_Name); $('#editcompanyName').html(respData[0].Company); $('#editemail').html(respData[0].Email); $('#editstate').html(respData[0].State); $('#editphone').html(respData[0].Phone); $('#editleadSource').html(respData[0].Lead_Source); $('#editForm').modal('show'); }, error: function (error) { $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); } function editLead() { var firstName = $("#editfirstName").val(); var lastName = $("#editlastName").val(); if (lastName == "") { alert("Kindly Enter the Last Name"); return; } var companyName = $("#editcompanyName").val(); var email = $("#editemail").val(); var state = $("#editstate").val(); var phone = $("#editphone").val(); var leadSource = $("#editleadSource").val(); var leadID = $("#editBtn").val(); $.ajax({ url: "/crmData/" + leadID, type: "put", contentType: "application/json", data: JSON.stringify({ "First_Name": firstName, "Last_Name": lastName, "Company": companyName, "Email": email, "State": state, "Phone": phone, "Lead_Source": leadSource }), success: function (data) { debugger; $('#editForm').modal('toggle'); $("#myModalLabel").html("Success"); $("#message").html("Lead Edited Successfully"); $('#myModal').modal('show'); setTimeout(function () { location.reload(); }, 3000); }, error: function (error) { $('#leads').trigger("reset"); $("#myModalLabel").html("Failure"); $("#message").html("Please try again after Sometime"); $("#loader").hide(); $('#myModal').modal('show'); } }); } function getRequiredData(data) { var i; var resp = []; for (i = 0; i < data.length; i++) { var gulp = { "First Name": data[i].First_Name, "Last Name": data[i].Last_Name, "Phone": data[i].Phone, "Email": data[i].Email, "Company": data[i].Company, "Edit": '<center><a href="javascript:showEditPopup(\'' + data[i].id + '\')">✎︎</a></center>', "Delete": '<center><a href="javascript:showDeletePopup(\'' + data[i].id + '\')">🗑︎</a></center>' } resp.push(gulp); } console.log(resp); return resp; } function renderTable(respData) { var col = []; for (var i = 0; i < respData.length; i++) { for (var key in respData[i]) { if (col.indexOf(key) === -1) { col.push(key); } } } var table = document.createElement("table"); table.id = "dataTable"; var tr = table.insertRow(-1); for (var i = 0; i < col.length; i++) { var th = document.createElement("th"); th.innerHTML = col[i]; tr.appendChild(th); } for (var i = 0; i < respData.length; i++) { tr = table.insertRow(-1); for (var j = 0; j < col.length; j++) { var tabCell = tr.insertCell(-1); tabCell.innerHTML = respData[i][col[j]]; } } var divContainer = document.getElementById("showData"); divContainer.innerHTML = ""; divContainer.appendChild(table); } ``` **app-config.json** ```json { "command": "python3 -u main.py", "build_path": "/", "stack": "python_3_9", "env_variables": {}, "memory": 256, "scripts": {}, "raw": {}, "catalyst_auth": true, "login_redirect": "/index.html" } ``` > **Note:** `buildpath`キーに正しい値を指定してください。 それでは、アプリケーションコードのロジックと機能について説明します。 * クライアントコンポーネントの`login.html`ファイルは、Catalyst Embedded Authenticationログインを有効にし、Zohoソーシャルログインを使用してログインできるようにします。 * `index.html`ファイルには、クライアントのフロントエンドのコードが含まれています。`Client ID`やスコープなどの必要な認証情報を渡してCRMアカウントへの接続を有効にする`navigate()`関数を定義しています。 * アプリケーションのバックエンドロジックは、さまざまなアクションを実行する以下のAPIを定義しています: - `/generateToken`:`getRefreshToken()`関数を呼び出して*Refresh Token*を取得し、現在のユーザーの`userID`とともに*Data Store*の`Token`テーブルに挿入します。その後、クライアントのインデックスページにリダイレクトします。 - `/getUserDetails`:`getUserDetails()`関数を呼び出してユーザーの詳細を取得します。テーブルにレコードがない場合は、`userID`のみを含むJSONレスポンスが送信されます。レコードがテーブルに存在する場合は、`userID`とともに送信されます。 - `/crmData`:このルートは、Leadsモジュールのすべてのリードのパスを定義します。Nodeファンクションは、このルートを使用してHTTP `GET`および`POST`操作を実行し、すべてのリードの取得または新しいリードの作成をそれぞれ行います。 - `/crmData/:id`:このルートは、Leadsモジュールの特定のリードのパスを定義します。`id`は、CRM内のリードの一意のIDを表します。ファンクションは、このルートを使用してHTTP `PUT`および`DELETE`操作を実行し、リードの編集または削除をそれぞれ行います。 * バックエンドロジックは、APIから呼び出される以下の関数を使用して実装されています: - `getRefreshToken()`:`Client ID`、`Client Secret`、*Redirect URI*、およびその他の必要な値をクエリ文字列パラメータとして渡すことで、*Refresh Token*を取得します。 - `getAccessToken()`:[ZCQL](https://docs.catalyst.zoho.com/ja/cloud-scale/help/zcql/introduction/)を使用してTokenテーブルからクエリした*Refresh Token*とその他の必要なパラメータを渡すことで、*Access Token*を取得します。Access Tokenは、リードの追加やリードの編集など、CRMモジュールで操作を実行する必要があるたびに取得されます。 - `getResponse()`:取得した*Access Token*を渡して、CRMモジュールで各アクションを実行するために必要な認証を取得します。この関数は、各`/crmData`および`/crmData/:id` APIでリクエストを認証するために呼び出されます。 - `getUserDetails()`:`userID`を渡すことで、*Refresh Token*を含む*Token*テーブルからレコードを取得します。 * `main.js`:クライアントコンポーネントのJavaScript関数で、ファンクションから取得したJSONレスポンスを解析し、`index.html`ページにレンダリングします。この関数は、クライアントアプリケーションのすべてのUI要素のアクションを定義します。例えば、`getLeads()`はファンクションのレスポンスからすべてのリードを取得してクライアントにレンダリングし、`showEditPopup()`はリードの編集アクションを定義します。 -------------------------------------------------------------------------------- title: "アプリケーションのテスト" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-08-17T12:16:04.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/test-app/" service: "All Services" related: - CLIヘルプドキュメント (/ja/cli/v1/cli-command-reference/) - リソースの提供 (/ja/cli/v1/serve-resources/introduction/) -------------------------------------------------------------------------------- # アプリケーションのテスト リモートコンソールにアプリケーションをデプロイする前に、Catalyst CLIを使用して[ローカルサーバーでアプリケーションをテスト](https://docs.catalyst.zoho.com/ja/cli/v1/serve-resources/introduction)し、すべてが正常に動作するか確認できます。 Catalystプロジェクトをローカルでサーブするには、プロジェクトディレクトリから以下のコマンドを実行します: ```sh catalyst serve ``` Lead Managerアプリケーションがデフォルトの`port 3000`でサーブされます。コンポーネントのローカルエンドポイントURLが表示されます。 > **Info:** クライアントのホームページやサブページ、またはファンクションにアクセスするたびに、CLIはアクセスされたURLとHTTPリクエストメソッドのライブログを表示します。 > **Note:** [ステップ**4**でクライアントを登録](https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/express/register-client/)した際に、必要な**Authorized Redirect URIs**を入力していることを確認してください。 ![catalyst_tutorials_leadmanager_appsail_flask_local_serve](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_flask_local_serve.webp) CLIに表示されるクライアントのローカルURLを使用して、ブラウザでアプリケーションを開くことができます。 最初にログインページにリダイレクトされます。独自のサインアップ機能を設定した場合は、まずサインアップしてからアプリケーションにログインできます。または、*Zoho Social Login*を使用してログインすることもできます。 ![catalyst_tutorials_leadmanager_appsail_serve_1](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_1.webp) 権限ページにリダイレクトされます。アプリがZohoアカウントの詳細にアクセスするために要求する権限を承認します。その後、アプリケーションにリダイレクトされます。このページの**Zoho CRM**アイコンをクリックしてZoho CRMに接続します。 ![catalyst_tutorials_leadmanager_appsail_serve_crm_icon](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_crm_icon.webp) Lead Managerアプリに接続する**CRMアカウントを選択**し、**Submit**をクリックします。 既存のすべての開発者、サンドボックス、および本番アカウントが一覧表示されます。*Lead Manager*アプリがZoho CRMモジュールにアクセスすることを許可するために**Accept**をクリックします。 ![catalyst_tutorials_leadmanager_appsail_serve_accept_action](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_accept_action.webp) アプリケーションにリダイレクトされます。設定したZoho CRMアカウントで直接リードの作成と管理ができるようになります。 リードを追加するには、*Add a Lead*セクションにリードの詳細を入力し、**Add Lead**をクリックします。 ![catalyst_tutorials_leadmamanger_appsail_serve_adding_lead](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmamanger_appsail_serve_adding_lead.webp) リードの追加、編集、または削除のたびに、確認ポップアップがステータスを表示します。 ![catalyst_tutorials_leadmanager_appsail_serve_confirmation_popup](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_confirmation_popup.webp) **Manage Leads**タブをクリックすると、*Leads*モジュールのすべてのリードを表示できます。テーブル内のそれぞれのアイコンをクリックして、リードの**編集**または**削除**ができます。 ![catalyst_tutorials_leadmanager_appsail_manage_leads_edit_del](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_manage_leads_edit_del.webp) リードの情報を更新し、**Edit**をクリックします。 ![catalyst_tutorials_leadmanmager_appsail_serve_edit_lead](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanmager_appsail_serve_edit_lead.webp) **削除**アイコンをクリックした場合は、確認ポップアップでアクションを確認する必要があります。 ![catalyst_tutorials_leadmanager_appsail_serve_delete_lead](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_delete_lead.webp) Catalystコンソールの**Data Store**で*Refresh Token*と`userID`の値が入力されていることも確認できます。 追加されたレコードを表示するには、*Token*テーブルの**Data View**セクションに移動します。 ![catalyst_tutorials_leadmanager_appsail_serve_datastoreview](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_serve_datastoreview.webp) このエントリを削除した場合、クライアントアプリケーションで認証情報を再度認証し、CRMアカウントへの接続を再確立する必要があります。 **Logout**をクリックしてアプリケーションからログアウトできます。 ターミナルでOSに応じた実行中のプロセスを終了するコマンドを実行して、`serve`セッションを終了できます。 このセットアップが正しく動作している場合、アプリケーションを本番環境にデプロイできます。 -------------------------------------------------------------------------------- title: "アプリケーションのデプロイ" description: "Lead Managerアプリケーションを構築し、AppSailにホスティングします。このアプリはCatalystコネクタを使用してZoho CRMアカウントに接続し、CRMのLeadsモジュールからリードの表示、作成、更新、削除を行うことができます。" last_updated: "2026-10-30T17:47:18.000Z" source: "https://docs.catalyst.zoho.com/ja/tutorials/leadmanager-appsail/flask/deploy-app/" service: "All Services" related: - CLIヘルプドキュメント (/ja/cli/v1/cli-command-reference/) - リソースのデプロイ (/ja/cli/v1/deploy-resources/introduction/) - AppSailヘルプドキュメント (/ja/serverless/help/appsail/introduction/) -------------------------------------------------------------------------------- # アプリケーションのデプロイ リモートコンソールにアプリケーションをデプロイできます。 > **Note:** ローカルサーバーから**Lead Manager**アプリケーションに既にログインしているため、*Refresh Token*は既に生成されています。このトークンは引き続きアクセスの認証に使用されます。 CLIから[Catalystプロジェクトをデプロイ](https://docs.catalyst.zoho.com/ja/cli/v1/deploy-resources/introduction)するには、プロジェクトディレクトリからターミナルで以下のコマンドを実行します: ```sh catalyst deploy ``` まずファンクションがデプロイされ、次にクライアントコンポーネントがデプロイされます。コンポーネントのアプリURLが表示されます。 ![catalyst_tutorials_leadmanager_appsail_python_deploy](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_python_deploy.webp) アプリケーションがCatalystコンソールにデプロイされました。 次に、*Serverless*セクションの下にあるAppSailコンポーネントに再度移動すると、アプリケーションの呼び出しURLを取得できます。 ![catalyst_tutorials_leadmanager_appsail_deploy_final_2](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_deploy_final_2.webp) このセクションでは、Lead Managerアプリサービスが任意の時点でスポーンしたインスタンス数を示すライブダッシュボードにもアクセスできます。このセクションを使用して、AppSailサービスの設定と管理も行えます。詳細については[こちら](https://docs.catalyst.zoho.com/ja/serverless/help/appsail/console/overview/)をご参照ください。 ブラウザで呼び出しURLを使用して、デプロイされたアプリケーションにアクセスできます。Lead Managerアプリケーションは、[WebアプリURL](https://docs.catalyst.zoho.com/ja/cloud-scale/help/web-client-hosting/introduction)からアクセスできるようになりました。 ![catalyst_tutorials_leadmanager_appsail_deploy_app_final](https://catalyst-docs-development.zohostratus.in/images/tutorials/leadmanager-appsail/catalyst_tutorials_leadmanager_appsail_deploy_app_final.webp)