> ## 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 app notifications

> Trigger app push notifications for sandbox users using the same single or bulk send paths as production.

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


## OpenAPI

````yaml POST /test/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/notifications:
    post:
      tags:
        - Test
      summary: Send test app notifications
      description: >
        Trigger app push notifications for sandbox testing. The request body
        identifies the notification **template** using the same string
        identifiers used across the Wealthyhood app and NBG push APIs
        (`template_id` must be in the allowlist).


        - **Single user** (`users` has one id): creates a pending app
        notification and sends it immediately via the single-notification send
        path (`NotificationService.sendSingleAppNotification`).

        - **Multiple users** (`users` has two or more ids): creates one pending
        notification per user, then dispatches them via the bulk send path
        (`NotificationService.sendBulkAppNotifications`).


        Users must exist. Duplicate user ids in `users` are not allowed. The
        `templateId` must be an app notification id that has an NBG template
        mapping.


        Normal notification settings and device rules still apply (notifications
        may be skipped if the user has disabled the relevant category or device
        push).


        Optional **customData** is forwarded to partner (string keys; numeric
        values are stringified).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - templateId
                - users
              properties:
                templateId:
                  type: string
                  description: >
                    App notification event id (for example
                    `transactional_order_settled` or `learning_guide_created`).
                  example: transactional_order_settled
                users:
                  type: array
                  minItems: 1
                  description: >-
                    MongoDB ObjectIds of users to notify. Must be unique. Length
                    1 uses single send; length ≥ 2 uses bulk send.
                  items:
                    type: string
                    pattern: ^[a-f0-9]{24}$
                  example:
                    - 64f0c51e7fb3fc001234abcd
                customData:
                  type: object
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: number
                  description: Optional key/value map sent to partner.
                  example:
                    amount: '50.00'
            examples:
              singleUser:
                summary: Single user (single send path)
                value:
                  templateId: transactional_order_settled
                  users:
                    - 64f0c51e7fb3fc001234abcd
              multipleUsers:
                summary: Multiple users (bulk send path)
                value:
                  templateId: learning_guide_created
                  users:
                    - 64f0c51e7fb3fc001234abcd
                    - 64f1b2c3d4e5f67890123456
      responses:
        '200':
          description: >-
            Notifications created and dispatch attempted (see product rules for
            skipped sends).
          content:
            application/json:
              schema:
                type: object
                required:
                  - dispatch
                  - notificationIds
                properties:
                  dispatch:
                    type: string
                    enum:
                      - single
                      - bulk
                    description: Which code path was used for sending.
                  notificationIds:
                    type: array
                    items:
                      type: string
                    description: MongoDB ids of the created notification document(s).
              examples:
                single:
                  summary: Single-user response
                  value:
                    dispatch: single
                    notificationIds:
                      - 674a1b2c3d4e5f6789012345
                bulk:
                  summary: Bulk response
                  value:
                    dispatch: bulk
                    notificationIds:
                      - 674a1b2c3d4e5f6789012345
                      - 674a1b2c3d4e5f6789012346
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          description: One or more user ids do not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: One or more users were not found
                code: NOT_FOUND
components:
  responses:
    BadRequestError:
      description: Bad request – invalid parameters or malformed request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Invalid amount
            code: BAD_REQUEST
    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
  schemas:
    Error:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
          example: Invalid amount
        code:
          type: string
          example: BAD_REQUEST
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````