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

# Post User Registration

> Database またはパスワードレス接続でユーザーが作成された後に実行される Post User Registration Actions について説明します。ユーザーの登録を別のシステムに通知するために使用できます。

`post-user-registration` トリガーは、Database または <Tooltip tip="パスワードレス: パスワードを第一認証要素として使用しない認証方式。" cta="用語集を表示" href="/docs/ja-jp/glossary?term=Passwordless">パスワードレス</Tooltip>接続にユーザーが追加された後に実行されます。このトリガーを使用して、ユーザーがアプリケーションに登録したことを別のシステムに通知できます。このトリガーには複数の Action をバインドでき、それらの Actions は順番に実行されます。

<Frame>
  <img src="https://mintcdn.com/translations/pvjQqAy3EB2TK6NP/docs/images/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/079798c354f4a83355a756a6a02650d5/post-user-registration-flow.png?fit=max&auto=format&n=pvjQqAy3EB2TK6NP&q=85&s=cb7203a73a4441e489affcd3fee527c6" alt="Actions の Post User Registration フローの図。" width="713" height="141" data-path="docs/images/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/079798c354f4a83355a756a6a02650d5/post-user-registration-flow.png" />
</Frame>

このフローの Actions は非ブロッキング (非同期) です。Auth0 パイプラインは Action の完了を待たずに処理を継続するため、Action の結果は Auth0 トランザクションに影響しません。

<div id="references">
  ## リファレンス
</div>

* [イベントオブジェクト](/docs/ja-jp/customize/actions/reference/post-user-registration/post-user-registration-event-object): 新しく作成されたユーザーに関するコンテキスト情報を提供します。
* [API object](/docs/ja-jp/customize/actions/reference/post-user-registration/post-user-registration-api-object): フローの動作を変更するためのメソッドを提供します。

<div id="common-use-cases">
  ## 一般的なユースケース
</div>

<div id="notify-slack-when-a-new-user-registers">
  ### 新規ユーザーの登録時にSlackへ通知する
</div>

post-user-registration Actionを使用すると、新規ユーザーが登録されるたびにSlackチャンネルへ通知できます。

```javascript lines theme={null}
/**
 * @param {Event} event - 登録したユーザーとコンテキストに関する詳細。
 * @param {PostUserRegistrationAPI} api - ユーザー登録後の動作を変更するメソッドを提供するインターフェース。
 */
exports.onExecutePostUserRegistration = async (event, api) => {
  const { IncomingWebhook } = require("@slack/webhook");
  const webhook = new IncomingWebhook(event.secrets.SLACK_WEBHOOK_URL);

  const text = `New User: ${event.user.email}`;
  const channel = '#some_channel';

  webhook.send({ text, channel });
};
```

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  このActionを正しく実行するには、`SLACK_WEBHOOK_URL`という名前のSecretを設定し、`@slack/webhook` `npm`パッケージへの依存関係を追加する必要があります。
</Callout>

<div id="store-the-auth0-user-id-in-a-remote-system">
  ### Auth0 ユーザー ID を外部システムに保存する
</div>

post-user-registration Action を使用すると、Auth0 ユーザー ID を外部システムに保存できます。

```javascript lines theme={null}
const axios = require("axios");

/**
 * @param {Event} event - コンテキストおよび登録済みユーザーに関する詳細。
 * @param {PostUserRegistrationAPI} api - ユーザー登録後の処理の動作を変更するためのメソッドを提供するインターフェース。
 */
exports.onExecutePostUserRegistration = async (event, api) => {
  await axios.post("https://my-api.exampleco.com/users", { params: { email: event.user.email }});
};
```

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  `axios` などの `npm` ライブラリを使用するには、そのライブラリを Action の依存関係として追加する必要があります。詳しくは、[Write Your First Action](/docs/ja-jp/customize/actions/write-your-first-action) の「依存関係を追加する」セクションを参照してください。
</Callout>
