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

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

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

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

<Frame>
  <img src="https://mintcdn.com/generaltranslationinc/TAtXfl0iCCUYtXZs/docs/images/ja-jp/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/e3a057cac6b621855f1e481a4e1e68d1/post-user-registration-flow.png?fit=max&auto=format&n=TAtXfl0iCCUYtXZs&q=85&s=1945f636a8af86cd75ba84993fdb97a4" alt="Diagram of the Actions Post User Registration Flow." width="713" height="141" data-path="docs/images/ja-jp/cdy7uua7fh8z/4bqF9YEPYQshnJGCx39pws/e3a057cac6b621855f1e481a4e1e68d1/post-user-registration-flow.png" />
</Frame>

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

<div id="triggers">
  ## トリガー
</div>

<div id="post-user-registration">
  ### ユーザー登録後
</div>

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

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

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

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

<div id="notify-slack-when-a-new-user-registers">
  ### 新しいユーザーが登録されたらSlackに通知する
</div>

```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>

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

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/ja-jp/customize/actions/write-your-first-action)」の「依存関係を追加する」セクションをお読みください。
</Callout>
