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

# Send test email notifications (NBG)

> Trigger transactional emails for NBG sandbox users via the same create-and-send path as production.

<Warning>
  These test endpoints are **only available in development and staging environments**. They are disabled in
  production.
</Warning>


## OpenAPI

````yaml POST /test/email-notifications
openapi: 3.0.3
info:
  title: Wealthyhood Test API
  version: 1.0.0
  description: >
    Test endpoints for sandbox environments. These endpoints allow you to create
    test users, simulate deposits,

    send test app notifications, and manage test data.


    **Important**: These endpoints are only available in development and staging
    environments. They are disabled in production for security reasons.


    All requests require a bearer token.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.sandbox.wealthyhood.com
        description: Wealthyhood API host name (sandbox environment).
security:
  - bearerAuth: []
tags:
  - name: Test
    description: Test endpoints for sandbox environments.
paths:
  /test/email-notifications:
    post:
      tags:
        - Test
      summary: Send test email notifications (NBG)
      description: >
        Trigger transactional **email** notifications for sandbox testing for
        **NBG partner users** only.

        Uses `NotificationService.createEmailNotification` with
        `sendImmediately: true`, which dispatches via the NBG

        email API (`/v1/notifications/email/transactional`) when the environment
        allows.


        The `templateId` must be the NBG partner transactional email
        `template_id` (e.g. `email_account_verified`).


        The user must exist, must have `partnerId` NBG, and must have allowed
        the corresponding email category in

        notification settings. Optional **customData** is forwarded as NBG
        `custom_data` (string keys; numeric values are stringified).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - templateId
                - userId
              properties:
                templateId:
                  type: string
                  enum:
                    - email_account_verified
                    - email_monthly_investment
                    - email_account_deletion_requested
                    - email_account_deletion_completed
                    - email_account_deletion_completed_inactive
                  description: >-
                    NBG transactional email `template_id` sent to
                    `/v1/notifications/email/transactional`.
                  example: email_account_verified
                userId:
                  type: string
                  pattern: ^[a-f0-9]{24}$
                  description: MongoDB ObjectId of the NBG user to email.
                  example: 64f0c51e7fb3fc001234abcd
                customData:
                  type: object
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: number
                  description: Optional key/value map sent to NBG as custom_data.
                  example:
                    payment_url: /
            examples:
              accountVerified:
                summary: Account verified style payload
                value:
                  templateId: email_account_verified
                  userId: 64f0c51e7fb3fc001234abcd
                  customData:
                    payment_url: /
      responses:
        '200':
          description: >-
            Notification document created; dispatch attempted per NBG
            availability and user settings.
          content:
            application/json:
              schema:
                type: object
                required:
                  - notificationId
                  - status
                properties:
                  notificationId:
                    type: string
                    description: MongoDB id of the created notification document.
                  status:
                    type: string
                    enum:
                      - Pending
                      - Sent
                      - Skipped
                    description: Notification status after create/send attempt.
              example:
                notificationId: 674a1b2c3d4e5f6789012345
                status: Sent
        '400':
          description: >-
            Bad request – user is not NBG, email type not allowed by user
            settings, or invalid body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                notNbg:
                  summary: User is not an NBG partner user
                  value:
                    message: Test email notifications require an NBG partner user
                    code: BAD_REQUEST
                notAllowed:
                  summary: User has disabled the email category
                  value:
                    message: User has not allowed this email notification
                    code: BAD_REQUEST
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: User not found
                code: NOT_FOUND
components:
  schemas:
    Error:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
          example: Invalid amount
        code:
          type: string
          example: BAD_REQUEST
  responses:
    UnauthorizedError:
      description: Unauthorized – missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Authentication required
            code: UNAUTHORIZED
    ForbiddenError:
      description: >-
        Forbidden – valid credentials but insufficient permissions or endpoint
        not available in this environment.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Endpoint not available in production
            code: FORBIDDEN
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````