From dd9a6442727a5f93a5c72fe3fa220698cc057372 Mon Sep 17 00:00:00 2001
From: Shahed Nasser
Date: Fri, 1 Aug 2025 16:17:43 +0300
Subject: [PATCH] docs: added guide on sending invite user emails + updates to
reset password guide (#13122)
* docs: added guide on sending invite user emails + updates to reset password guide
* fix vale error
---
www/apps/book/public/llms-full.txt | 884 +++++++++++++++++-
.../auth/reset-password/page.mdx | 453 ++++++++-
.../cart/cart-totals/page.mdx | 6 +-
.../order/order-totals/page.mdx | 10 +-
.../user/invite-user-subscriber/page.mdx | 453 +++++++++
.../notification/local/page.mdx | 4 -
.../app/integrations/guides/resend/page.mdx | 9 +
www/apps/resources/generated/edit-dates.mjs | 9 +-
www/apps/resources/generated/files-map.mjs | 4 +
.../generated-commerce-modules-sidebar.mjs | 16 +-
.../generated-how-to-tutorials-sidebar.mjs | 10 +-
...nerated-infrastructure-modules-sidebar.mjs | 24 +-
.../generated/generated-tools-sidebar.mjs | 8 -
www/apps/resources/sidebars/user.mjs | 5 +
.../app/settings/users/invites/page.mdx | 2 +-
www/apps/user-guide/generated/edit-dates.mjs | 2 +-
www/packages/tags/src/tags/how-to.ts | 6 +-
www/packages/tags/src/tags/notification.ts | 6 +-
www/packages/tags/src/tags/server.ts | 6 +-
19 files changed, 1775 insertions(+), 142 deletions(-)
create mode 100644 www/apps/resources/app/commerce-modules/user/invite-user-subscriber/page.mdx
diff --git a/www/apps/book/public/llms-full.txt b/www/apps/book/public/llms-full.txt
index 0c7819ac84..968cfe30ca 100644
--- a/www/apps/book/public/llms-full.txt
+++ b/www/apps/book/public/llms-full.txt
@@ -24919,23 +24919,72 @@ Medusa provides the following authentication providers out-of-the-box. You can u
***
-# How to Handle Password Reset Token Event
+# Send Reset Password Email Notification
-In this guide, you'll learn how to handle the `auth.password_reset` event, which is emitted when a request is sent to the [Generate Reset Password Token API route](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#generate-reset-password-token-route/index.html.md).
+In this guide, you'll learn how to handle the `auth.password_reset` event to send a reset password email (or other notification type) to users.
Refer to this [Medusa Admin User Guide](https://docs.medusajs.com/user-guide/reset-password/index.html.md) to learn how to reset your user admin password using the dashboard.
-You'll create a subscriber that listens to the event. When the event is emitted, the subscriber sends an email notification to the user.
+## Reset Password Flow Overview
-### Prerequisites
+
-- [A notification provider module, such as SendGrid](https://docs.medusajs.com/infrastructure-modules/notification/sendgrid/index.html.md)
+Users of any actor type (admin, customer, or custom actor type) can request to reset their password. The flow for resetting a password is as follows:
-## 1. Create Subscriber
+1. The user requests to reset their password either through the frontend (for example, [Medusa Admin](https://docs.medusajs.com/user-guide/reset-password/index.html.md)) or the [Generate Reset Password Token API route](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#generate-reset-password-token-route/index.html.md).
+2. The Medusa application generates a password reset token and emits the `auth.password_reset` event.
+ - At this point, you can handle the event to send a notification to the user with instructions on how to reset their password.
+3. The user receives the notification and clicks on the link to reset their password.
+ - The user can reset their password either through the frontend (for example, [Medusa Admin](https://docs.medusajs.com/user-guide/reset-password/index.html.md)) or the [Reset Password API route](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#reset-password-route/index.html.md).
-The first step is to create a subscriber that listens to the `auth.password_reset` and sends the user a notification with instructions to reset their password.
+In this guide, you'll implement a subscriber that handles the `auth.password_reset` event to send an email notification to the user with instructions on how to reset their password.
-Create the file `src/subscribers/handle-reset.ts` with the following content:
+After adding the subscriber, you will have a complete reset password flow you can utilize using the Medusa admin, storefront, or API routes.
+
+***
+
+## Prerequisites: Notification Module Provider
+
+To send an email or notification to the user, you must have a Notification Module Provider set up.
+
+Medusa provides providers like [SendGrid](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/sendgrid/index.html.md) and [Resend](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/integrations/guides/resend/index.html.md), and you can also [create your own custom provider](https://docs.medusajs.com/references/notification-provider-module/index.html.md).
+
+Refer to the [Notification Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification#what-is-a-notification-module-provider/index.html.md) documentation for a list of available providers and how to set them up.
+
+### Testing with the Local Notification Module Provider
+
+For testing purposes, you can use the [Local Notification Module Provider](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/local/index.html.md) by adding this to your `medusa-config.ts`:
+
+```ts title="medusa-config.ts"
+module.exports = defineConfig({
+ // ...
+ modules: [
+ {
+ resolve: "@medusajs/medusa/notification",
+ options: {
+ providers: [
+ // ...
+ {
+ resolve: "@medusajs/medusa/notification-local",
+ id: "local",
+ options: {
+ channels: ["email"],
+ },
+ },
+ ],
+ },
+ },
+ ],
+})
+```
+
+The Local provider logs email details to your terminal instead of sending actual emails, which is useful for development and testing.
+
+***
+
+## Create the Reset Password Subscriber
+
+To create a [subscriber](https://docs.medusajs.com/docs/learn/fundamentals/events-and-subscribers/index.html.md) that handles the `auth.password_reset` event, create the file `src/subscribers/password-reset.ts` with the following content:
```ts title="src/subscribers/handle-reset.ts" highlights={highlights} collapsibleLines="1-6" expandMoreLabel="Show Imports"
import {
@@ -24955,18 +25004,27 @@ export default async function resetPasswordTokenHandler({
const notificationModuleService = container.resolve(
Modules.NOTIFICATION
)
+ const config = container.resolve("configModule")
- const urlPrefix = actor_type === "customer" ?
- "https://storefront.com" :
- "https://admin.com/app"
+ let urlPrefix = ""
+
+ if (actor_type === "customer") {
+ urlPrefix = config.admin.storefrontUrl || "https://storefront.com"
+ } else {
+ const backendUrl = config.admin.backendUrl !== "/" ? config.admin.backendUrl :
+ "http://localhost:9000"
+ const adminPath = config.admin.path
+ urlPrefix = `${backendUrl}${adminPath}`
+ }
await notificationModuleService.createNotifications({
to: email,
channel: "email",
- template: "reset-password-template",
+ // TODO replace with template ID in notification provider
+ template: "password-reset",
data: {
// a URL to a frontend application
- url: `${urlPrefix}/reset-password?token=${token}&email=${email}`,
+ reset_url: `${urlPrefix}/reset-password?token=${token}&email=${email}`,
},
})
}
@@ -24976,7 +25034,7 @@ export const config: SubscriberConfig = {
}
```
-You subscribe to the `auth.password_reset` event. The event has a data payload object with the following properties:
+The subscriber receives the following data through the event payload:
- `entity_id`: The identifier of the user. When using the `emailpass` provider, it's the user's email.
- `token`: The token to reset the user's password.
@@ -24984,41 +25042,46 @@ You subscribe to the `auth.password_reset` event. The event has a data payload o
This event's payload previously had an `actorType` field. It was renamed to `actor_type` after [Medusa v2.0.7](https://github.com/medusajs/medusa/releases/tag/v2.0.7).
-In the subscriber, you:
+### Reset Password URL
-- Decide the frontend URL based on whether the user is a customer or admin user by checking the value of `actor_type`.
-- Resolve the Notification Module and use its `createNotifications` method to send the notification.
-- You pass to the `createNotifications` method an object having the following properties:
- - `to`: The identifier to send the notification to, which in this case is the email.
- - `channel`: The channel to send the notification through, which in this case is email.
- - `template`: The template ID in the third-party service.
- - `data`: The data payload to pass to the template. You pass the URL to redirect the user to. You must pass the token and email in the URL so that the frontend can send them later to the Medusa application when reseting the password.
+Based on the user's actor type, you set the URL prefix to redirect the user to the appropriate frontend page to reset their password:
-***
+- If the user is a customer, you set the URL prefix to the storefront URL.
+- If the user is an admin, you set the URL prefix to the backend URL, which is constructed from the `config.admin.backendUrl` and `config.admin.path` values.
-## 2. Test it Out: Generate Reset Password Token
+Note that the Medusa Admin has a reset password form at `/reset-password?token={token}&email={email}`.
-To test the subscriber out, send a request to the `/auth/{actor_type}/{auth_provider}/reset-password` API route, replacing `{actor_type}` and `{auth_provider}` with the user's actor type and provider used for authentication respectively.
+### Notification Configurations
-For example, to generate a reset password token for an admin user using the `emailpass` provider, send the following request:
+For the notification, you can configure the following fields:
-```bash
-curl --location 'http://localhost:9000/auth/user/emailpass/reset-password' \
---header 'Content-Type: application/json' \
---data-raw '{
- "identifier": "admin-test@gmail.com"
-}'
+- `to`: The identifier to send the notification to, which in this case is the email.
+- `channel`: The channel to send the notification through, which in this case is email.
+- `template`: The template ID of the email to send. This ID depends on the Notification Module provider you use. For example, if you use SendGrid, this would be the ID of the SendGrid template.
+ - Refer to the [Example Notification Templates](#example-notification-templates) section below for examples of notification templates to use.
+- `data`: The data payload to pass to the template. You can pass additional fields, if necessary.
+
+### Test It Out
+
+After you set up the Notification Module Provider, create a template in the provider, and create the subscriber, you can test the reset password flow.
+
+Start the Medusa application with the following command:
+
+```bash npm2yarn
+npm run dev
```
-In the request body, you must pass an `identifier` parameter. Its value is the user's identifier, which is the email in this case.
+Then, open the Medusa Admin (locally at `http://localhost:9000/app`) and click on "Reset" in the login form. Then, enter the email of the user you want to reset the password for.
-If the token is generated successfully, the request returns a response with `201` status code. In the terminal, you'll find the following message indicating that the `auth.password_reset` event was emitted and your subscriber ran:
+Once you reset the password, you should see that the `auth.password_reset` event is emitted in the server's logs:
-```plain
+```bash
info: Processing auth.password_reset which has 1 subscribers
```
-The notification is sent to the user with the frontend URL to enter a new password.
+If you're using an email Notification Module Provider, check the user's email inbox for the reset password email with the link to reset their password.
+
+If you're using the Local provider, check your terminal for the logged email details.
***
@@ -25028,10 +25091,305 @@ In your frontend, you must have a page that accepts `token` and `email` query pa
The page shows the user password fields to enter their new password, then submits the new password, token, and email to the [Reset Password Route](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#reset-password-route/index.html.md).
+The Medusa Admin already has a reset password page at `/reset-password?token={token}&email={email}`. So, you only need to implement this page in your storefront or custom admin dashboard.
+
### Examples
- [Storefront Guide: Reset Customer Password](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/storefront-development/customers/reset-password/index.html.md)
+***
+
+## Example Notification Templates
+
+The following section provides example notification templates for some Notification Module Providers.
+
+### SendGrid
+
+Refer to the [SendGrid Notification Module Provider](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/sendgrid/index.html.md) documentation for more details on how to set up SendGrid.
+
+The following HTML template can be used with SendGrid to send a reset password email:
+
+```html
+
+
+
+
+
+ Reset Your Password
+
+
+
+
+
+
Reset Your Password
+
+
+
+
+ Hello{{#if email}} {{email}}{{/if}},
+
+
+ We received a request to reset your password. Click the button below to create a new password for your account.
+
+ This password reset link will expire soon for security reasons.
+
+
+ If you didn't request a password reset, you can safely ignore this email. Your password will remain unchanged.
+
+
+
+
+
+
+
+```
+
+Make sure to pass the `reset_url` variable to the template, which contains the URL to reset the password.
+
+You can also customize the template further to show other information.
+
+### Resend
+
+If you've integrated Resend as explained in the [Resend Integration Guide](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/integrations/guides/resend/index.html.md), you can add a new template for password reset emails at `src/modules/resend/emails/password-reset.tsx`:
+
+```tsx title="src/modules/resend/emails/password-reset.tsx"
+import {
+ Text,
+ Container,
+ Heading,
+ Html,
+ Section,
+ Tailwind,
+ Head,
+ Preview,
+ Body,
+ Link,
+ Button,
+} from "@react-email/components"
+
+type PasswordResetEmailProps = {
+ reset_url: string
+ email?: string
+}
+
+function PasswordResetEmailComponent({ reset_url, email }: PasswordResetEmailProps) {
+ return (
+
+
+ Reset your password
+
+
+
+
+
+ Reset Your Password
+
+
+
+
+
+ Hello{email ? ` ${email}` : ""},
+
+
+ We received a request to reset your password. Click the button below to create a new password for your account.
+
+
+
+
+
+
+
+
+
+ Or copy and paste this URL into your browser:
+
+
+ {reset_url}
+
+
+
+
+
+ This password reset link will expire soon for security reasons.
+
+
+ If you didn't request a password reset, you can safely ignore this email. Your password will remain unchanged.
+
+
+
+
+
+ For security reasons, never share this reset link with anyone. If you're having trouble with the button above, copy and paste the URL into your web browser.
+
+
+
+
+
+
+ )
+}
+
+export const passwordResetEmail = (props: PasswordResetEmailProps) => (
+
+)
+
+// Mock data for preview/development
+const mockPasswordReset: PasswordResetEmailProps = {
+ reset_url: "https://your-app.com/reset-password?token=sample-reset-token-123",
+ email: "user@example.com",
+}
+
+export default () =>
+```
+
+Feel free to customize the email template further to match your branding and style, or to add additional information.
+
+Then, in the Resend Module's service at `src/modules/resend/service.ts`, add the new template to the `templates` object and `Templates` type:
+
+```ts title="src/modules/resend/service.ts"
+// other imports...
+import { passwordResetEmail } from "./emails/password-reset"
+
+enum Templates {
+ // ...
+ PASSWORD_RESET = "password-reset",
+}
+
+const templates: {[key in Templates]?: (props: unknown) => React.ReactNode} = {
+ // ...
+ [Templates.PASSWORD_RESET]: passwordResetEmail,
+}
+```
+
+Finally, find the `getTemplateSubject` function in the `ResendNotificationProviderService` and add a case for the `USER_INVITED` template:
+
+```ts title="src/modules/resend/service.ts"
+class ResendNotificationProviderService extends AbstractNotificationProviderService {
+ // ...
+
+ private getTemplateSubject(template: Templates) {
+ // ...
+ switch (template) {
+ // ...
+ case Templates.PASSWORD_RESET:
+ return "Reset Your Password"
+ }
+ }
+}
+```
+
# Retrieve Cart Totals using Query
@@ -25135,7 +25493,7 @@ const { data: [cart] } = await query.graph({
],
filters: {
id: "cart_123", // Specify the cart ID
- }
+ },
})
```
@@ -25289,7 +25647,7 @@ const { data: [cart] } = await query.graph({
fields: ["*"],
filters: {
id: "cart_123",
- }
+ },
})
// cart doesn't include cart totals
@@ -25321,7 +25679,7 @@ const { data: [cart] } = await query.graph({
fields: ["*", "total"],
filters: {
id: "cart_123",
- }
+ },
})
// cart doesn't include cart totals
@@ -29154,7 +29512,7 @@ export const myWorkflow = createWorkflow(
"gift_card_tax_total",
"items.*",
"shipping_methods.*",
- "summary.*"
+ "summary.*",
],
filters: {
id: "order_123", // Specify the order ID
@@ -29198,11 +29556,11 @@ const { data: [order] } = await query.graph({
"gift_card_tax_total",
"items.*",
"shipping_methods.*",
- "summary.*"
+ "summary.*",
],
filters: {
id: "order_123", // Specify the order ID
- }
+ },
})
```
@@ -29388,7 +29746,7 @@ const { data: [order] } = await query.graph({
fields: ["*"],
filters: {
id: "order_123",
- }
+ },
})
// order doesn't include order totals
@@ -29420,7 +29778,7 @@ const { data: [order] } = await query.graph({
fields: ["*", "total"],
filters: {
id: "order_123",
- }
+ },
})
// order doesn't include order totals
@@ -36505,6 +36863,431 @@ You can use Medusa's default tax provider or create a custom one, allowing you t
Learn more about tax providers in the [Tax Provider](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/tax/tax-provider/index.html.md) guide.
+# Send Invite User Email Notification
+
+In this guide, you'll learn how to handle the `invite.created` and `invite.resent` events to send an invite email (or other notification type) to the user.
+
+Refer to the [Manage Invites](https://docs.medusajs.com/user-guide/settings/users/invites/index.html.md) user guide to learn how to manage invites using the Medusa Admin.
+
+## User Invite Flow Overview
+
+
+
+Admin users can add new users to their store by sending them an invite. The flow for inviting users is as follows:
+
+1. An admin user invites a user either through the [Medusa Admin](https://docs.medusajs.com/user-guide/settings/users/invites/index.html.md) or using the [Create Invite API route](https://docs.medusajs.com/api/admin#invites_postinvites).
+2. The invite is created and the `invite.created` event is emitted.
+ - At this point, you can handle the event to send an email or notification to the user.
+3. The invited user receives the invite and can accept it, which creates a new user.
+ - The invited user can accept the invite either through the Medusa Admin or using the [Accept Invite API route](https://docs.medusajs.com/api/admin#invites_postinvitesaccept).
+
+The admin user can also resend the invite if the invited user doesn't receive the invite or doesn't accept it before expiry, which emits the `invite.resent` event.
+
+In this guide, you'll implement a subscriber that handles the `invite.created` and `invite.resent` events to send an email to the user.
+
+After adding the subscriber, you will have a complete user invite flow that you can utilize either through the Medusa Admin or using the Admin APIs.
+
+***
+
+## Prerequisites: Notification Module Provider
+
+To send an email or notification to the user, you must have a Notification Module Provider set up.
+
+Medusa provides providers like [SendGrid](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/sendgrid/index.html.md) and [Resend](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/integrations/guides/resend/index.html.md), and you can also [create your own custom provider](https://docs.medusajs.com/references/notification-provider-module/index.html.md).
+
+Refer to the [Notification Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification#what-is-a-notification-module-provider/index.html.md) documentation for a list of available providers and how to set them up.
+
+### Testing with the Local Notification Module Provider
+
+For testing purposes, you can use the [Local Notification Module Provider](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/local/index.html.md) by adding this to your `medusa-config.ts`:
+
+```ts title="medusa-config.ts"
+module.exports = defineConfig({
+ // ...
+ modules: [
+ {
+ resolve: "@medusajs/medusa/notification",
+ options: {
+ providers: [
+ // ...
+ {
+ resolve: "@medusajs/medusa/notification-local",
+ id: "local",
+ options: {
+ channels: ["email"],
+ },
+ },
+ ],
+ },
+ },
+ ],
+})
+```
+
+The Local provider logs email details to your terminal instead of sending actual emails, which is useful for development and testing.
+
+***
+
+## Create the Invite User Subscriber
+
+To create a [subscriber](https://docs.medusajs.com/docs/learn/fundamentals/events-and-subscribers/index.html.md) that handles the `invite.created` and `invite.resent` events, create the file `src/subscribers/user-invited.ts` with the following content:
+
+```ts title="src/subscribers/user-invited.ts" highlights={highlights}
+import { SubscriberArgs, type SubscriberConfig } from "@medusajs/framework"
+
+export default async function inviteCreatedHandler({
+ event: { data },
+ container,
+}: SubscriberArgs<{
+ id: string
+}>) {
+ const query = container.resolve("query")
+ const notificationModuleService = container.resolve(
+ "notification"
+ )
+ const config = container.resolve("configModule")
+
+ const { data: [invite] } = await query.graph({
+ entity: "invite",
+ fields: [
+ "email",
+ "token",
+ ],
+ filters: {
+ id: data.id,
+ },
+ })
+
+ const backend_url = config.admin.backendUrl !== "/" ? config.admin.backendUrl :
+ "http://localhost:9000"
+ const adminPath = config.admin.path
+
+ await notificationModuleService.createNotifications({
+ to: invite.email,
+ // TODO replace with template ID in notification provider
+ template: "user-invited",
+ channel: "email",
+ data: {
+ invite_url: `${backend_url}${adminPath}/invite?token=${invite.token}`,
+ },
+ })
+}
+
+export const config: SubscriberConfig = {
+ event: [
+ "invite.created",
+ "invite.resent",
+ ],
+}
+```
+
+The subscriber receives the ID of the invite in the event payload. You resolve [Query](https://docs.medusajs.com/docs/learn/fundamentals/module-links/query/index.html.md) to fetch the invite details, including the email and token.
+
+### Invite URL
+
+You then use the Notification Module's service to send an email to the user with the invite link. The invite link is constructed using:
+
+1. The backend URL of the Medusa application, since the Medusa Admin is hosted on the same URL.
+2. The admin path, which is the path to the Medusa Admin (for example, `/app`).
+
+Note that the Medusa Admin has an invite form at `/invite?token=`, which accepts the invite token as a query parameter.
+
+### Notification Configurations
+
+For the notification, you can configure the following fields:
+
+- `template`: The template ID of the email to send. This ID depends on the Notification Module provider you use. For example, if you use SendGrid, this would be the ID of the SendGrid template.
+ - Refer to the [Example Notification Templates](#example-notification-templates) section below for examples of notification templates to use.
+- `channel`: The channel to send the notification through. In this case, it's set to `email`.
+- `data`: The data to pass to the notification template. You can add additional fields as needed, such as the invited user's email.
+
+### Test It Out
+
+After you set up the Notification Module Provider, create a template in the provider, and create the subscriber, you can test the full invite flow.
+
+Start the Medusa application with the following command:
+
+```bash npm2yarn
+npm run dev
+```
+
+Then, open the Medusa Admin (locally at `http://localhost:9000/app`) and go to Settings → Users. Create an invite as explained in the [Manage Invites](https://docs.medusajs.com/user-guide/settings/users/invites/index.html.md) user guide.
+
+Once you create the invite, you should see that the `invite.created` event is emitted in the server's logs:
+
+```bash
+info: Processing invite.created which has 1 subscribers
+```
+
+If you're using an email Notification Module Provider, check the recipient's email inbox for the invite email with the link to accept the invite.
+
+If you're using the Local provider, check your terminal for the logged email details.
+
+***
+
+## Example Notification Templates
+
+The following section provides example notification templates for some Notification Module Providers.
+
+### SendGrid
+
+Refer to the [SendGrid Notification Module Provider](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/notification/sendgrid/index.html.md) documentation for more details on how to set up SendGrid.
+
+The following HTML template can be used with SendGrid to send an invite email:
+
+```html
+
+
+
+
+
+ You're Invited!
+
+
+
+
+
+
You're Invited!
+
+
+
+
+ Hello{{#if email}} {{email}}{{/if}},
+
+
+ You've been invited to join our platform. Click the button below to accept your invitation and set up your account.
+
+
+
+```
+
+Make sure to pass the `invite_url` variable to the template, which contains the URL to accept the invite.
+
+You can also customize the template further to show other information, such as the user's email.
+
+### Resend
+
+If you've integrated Resend as explained in the [Resend Integration Guide](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/integrations/guides/resend/index.html.md), you can add a new template for user invites at `src/modules/resend/emails/user-invited.tsx`:
+
+```tsx title="src/modules/resend/emails/user-invited.tsx"
+import {
+ Text,
+ Container,
+ Heading,
+ Html,
+ Section,
+ Tailwind,
+ Head,
+ Preview,
+ Body,
+ Link,
+ Button,
+} from "@react-email/components"
+
+type UserInvitedEmailProps = {
+ invite_url: string
+ email?: string
+}
+
+function UserInvitedEmailComponent({ invite_url, email }: UserInvitedEmailProps) {
+ return (
+
+