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

# ユーザー登録後トリガー

> データベースまたはパスワードレス接続に対してユーザーが作成された後に実行される、ユーザー登録後フローとpost-user-registrationアクショントリガーについて説明します。

ユーザー登録後トリガーは、ユーザーがデータベースまたはパスワードレス接続に追加された後に実行されます。

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0/docs/images/ja-jp/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/e3a057cac6b621855f1e481a4e1e68d1/post-user-registration-flow.png" alt="Diagram of the Actions Post User Registration Flow." />
</Frame>

このフローのアクションは非ブロック（非同期）であるため、Authパイプラインの実行はアクションの完了を待たずに継続されます。そのため、アクションの結果は、Auth0のトランザクションに影響しません。

## トリガー

### ユーザー登録後

`post-user-registration`トリガーは、ユーザーがデータベースまたはパスワードレス接続用に作成された後に実行されます。このトリガーを使用して、ユーザーがアプリケーションに登録したことを別のシステムに通知できます。このトリガーには複数のアクションをバインドでき、アクションは順番に実行されます。ただし、これらのアクションは非同期で実行されるため、ユーザー登録プロセスがブロックされることはありません。

### リファレンス

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

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

### 新しいユーザーが登録されたらSlackに通知する

```javascript lines theme={null}
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
* 
 * @param {Event} event - Details about the context and user that has registered.
 * @param {PostUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of post user registration.
 */

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">
  このアクションが正常に動作するには、アクションが`SLACK_WEBHOOK_URL`という名前のシークレットを含み、`@slack/webhook`の`npm`パッケージに依存しなければなりません。
</Callout>

### Auth0ユーザーIDをリモートシステムに保存する

post-user-registrationアクションを使用して、Auth0ユーザーIDをリモートシステムに保存できます。

```javascript lines theme={null}
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
* 
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of post user registration.
*/

const axios = require("axios");

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`ライブラリーを使用する場合は、そのライブラリーをアクションに依存関係として追加しなければなりません。詳細については、「[初めてアクションを作成する](/docs/ja-jp/customize/actions/write-your-first-action)」の「依存関係を追加する」セクションをお読みください。
</Callout>
