Webhook 事件 (Webhooks events)
本指南列出各種 Logto Webhook 事件,並說明每個事件發生的時機。
使用者互動 Hook 事件 (User interaction hook events)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| PostRegister | 使用者透過 UI 介面成功建立新帳號。 |
| PostSignIn | 使用者透過 UI 介面成功登入。 |
| PostResetPassword | 使用者透過「忘記密碼」流程成功重設密碼。 |
資料變更 Hook 事件 (Data mutation hook events)
使用者 (User)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| User.Created | 建立新使用者帳號。 |
| User.Deleted | 刪除使用者帳號。 |
| User.Data.Updated | 更新使用者個人資料,例如電子郵件、頭像、custom.data、社交識別碼等。 |
| User.SuspensionStatus.Updated | 使用者停權狀態變更(停權或重新啟用)。 |
角色 (Role)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| Role.Created | 建立新角色。 |
| Role.Deleted | 刪除角色。 |
| Role.Data.Updated | 更新角色資料,例如角色名稱、描述、預設角色狀態。 |
| Role.Scopes.Updated | 新增或移除指派給角色的權限。 |
權限(Scope)(Permission (Scope))
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| Scope.Created | 建立新的 API 權限。 |
| Scope.Deleted | 刪除 API 權限。 |
| Scope.Data.Updated | 更新 API 權限資料,例如權限描述。 |
組織 (Organization)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| Organization.Created | 建立新組織。 |
| Organization.Deleted | 刪除組織。 |
| Organization.Data.Updated | 更新組織資料,例如組織名稱、描述、custom.data 等。 |
| Organization.Membership.Updated | 新增或移除組織成員。 |
組織角色 (Organization role)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| OrganizationRole.Created | 建立新組織角色。 |
| OrganizationRole.Deleted | 刪除組織角色。 |
| OrganizationRole.Data.Updated | 更新組織角色資料,例如組織角色名稱與描述。 |
| OrganizationRole.Scopes.Updated | 新增或移除指派給組織角色的權限。 |
組織權限(Scope)(Organization permission (scope))
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| OrganizationScope.Created | 建立新組織權限。 |
| OrganizationScope.Deleted | 刪除組織權限。 |
| OrganizationScope.Data.Updated | 更新組織權限資料,例如組織權限描述。 |
Management API 觸發事件 (Management API triggered events)
| API endpoint | 事件 (Event) |
|---|---|
| POST /users | User.Created |
| DELETE /users/:userId | User.Deleted |
| PATCH /users/:userId | User.Data.Updated |
| PATCH /users/:userId/custom-data | User.Data.Updated |
| PATCH /users/:userId/profile | User.Data.Updated |
| PATCH /users/:userId/password | User.Data.Updated |
| PATCH /users/:userId/is-suspended | User.SuspensionStatus.Updated |
| POST /roles | Role.Created, (Role.Scopes.Update) |
| DELETE /roles/:id | Role.Deleted |
| PATCH /roles/:id | Role.Data.Updated |
| POST /roles/:id/scopes | Role.Scopes.Updated |
| DELETE /roles/:id/scopes/:scopeId | Role.Scopes.Updated |
| POST /resources/:resourceId/scopes | Scope.Created |
| DELETE /resources/:resourceId/scopes/:scopeId | Scope.Deleted |
| PATCH /resources/:resourceId/scopes/:scopeId | Scope.Data.Updated |
| POST /organizations | Organization.Created |
| DELETE /organizations/:id | Organization.Deleted |
| PATCH /organizations/:id | Organization.Data.Updated |
| PUT /organizations/:id/users | Organization.Membership.Updated |
| POST /organizations/:id/users | Organization.Membership.Updated |
| DELETE /organizations/:id/users/:userId | Organization.Membership.Updated |
| POST /organization-roles | OrganizationRole.Created, (OrganizationRole.Scopes.Updated) |
| DELETE /organization-roles/:id | OrganizationRole.Deleted |
| PATCH /organization-roles/:id | OrganizationRole.Data.Updated |
| POST /organization-scopes | OrganizationScope.Created |
| DELETE /organization-scopes/:id | OrganizationScope.Deleted |
| PATCH /organization-scopes/:id | OrganizationScope.Data.Updated |
| PUT /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated |
| POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated |
| DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated |
Interaction API 觸發事件 (Interaction API triggered events)
| 使用者互動行為 (User interaction action) | 事件 (Event) |
|---|---|
| 使用者電子郵件/電話綁定 | User.Data.Updated |
| 使用者 MFA 綁定 | User.Data.Updated |
| 使用者社交/單一登入 (SSO) 綁定 | User.Data.Updated |
| 使用者密碼重設 | User.Data.Updated |
| 使用者註冊 | User.Created |
例外 Hook 事件 (Exception hook events)
安全性 (Security)
| 事件類型 (Event type) | 說明 (Description) |
|---|---|
| Identifier.Lockout | 使用者帳號因多次登入失敗被鎖定。 |
常見問題 (FAQs)
PostRegister 與 User.Created 有什麼不同?(What's the difference between PostRegister and User.Created?)
PostRegister 與 User.Created 有什麼不同?(What's the difference between PostRegister and User.Created?)PostRegister 於使用者透過註冊流程成功建立新帳號時觸發;User.Created 則於透過 Management API 建立新使用者帳號時觸發。