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

# Post User Registration トリガーについて

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

`post-user-registration` トリガーは、Database または パスワードレス (パスワードレス: パスワードを第一認証要素として使用しない認証方式。)接続にユーザーが追加された後に実行されます。このトリガーを使用して、ユーザーがアプリケーションに登録したことを別のシステムに通知できます。このトリガーには複数の Action をバインドでき、それらの Actions は順番に実行されます。

![Actions の Post User Registration フローの図。](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/079798c354f4a83355a756a6a02650d5/post-user-registration-flow.png)

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

## リファレンス

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

## 一般的なユースケース

### 新規ユーザーの登録時にSlackへ通知する

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 });
};
```

このActionを正しく実行するには、`SLACK_WEBHOOK_URL`という名前のSecretを設定し、`@slack/webhook` `npm`パッケージへの依存関係を追加する必要があります。

### Auth0 ユーザー ID を外部システムに保存する

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 }});
};
```

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