Takazudo Modular Docs

Type to search...

to open search from anywhere

Admin Notify Send

Admin Notify Send

Send notification emails to pending subscribers for a product.

Endpoint

POST /api/admin/notify/send

Authentication

Requires Bearer token authentication.

Authorization: Bearer <ADMIN_API_TOKEN>

Request

Headers

HeaderRequiredValue
Content-TypeYesapplication/json
AuthorizationYesBearer <token>

Body

interface SendNotificationRequest {
  productSlug: string;   // Required: Product slug to notify subscribers for
  emailTitle: string;    // Required: Email subject line
  emailBody: string;     // Required: Email body content
}

Example Request

curl -X POST https://preview--takazudomodular.netlify.app/api/admin/notify/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ADMIN_API_TOKEN" \
  -d '{
    "productSlug": "vco-1",
    "emailTitle": "Takazudo Modular 入荷のお知らせ: VCO-1",
    "emailBody": "VCO-1の入荷をお知らせいたします。\n\n商品ページはこちらからご確認いただけます:\nhttps://takazudomodular.com/products/vco-1/\n\n引き続きTakazudo Modularをよろしくお願いいたします。"
  }'

Response

Success Response (200)

interface SendNotificationResponse {
  success: true;
  notificationId: string;    // Unique ID for this notification
  sentCount: number;         // Number of subscribers notified
  recipientEmails: string[]; // List of email addresses notified
  timestamp: string;         // ISO timestamp of when notification was sent
}

Example Success Response

{
  "success": true,
  "notificationId": "notif_abc123def456",
  "sentCount": 5,
  "recipientEmails": [
    "user1@example.com",
    "user2@example.com",
    "user3@example.com",
    "user4@example.com",
    "user5@example.com"
  ],
  "timestamp": "2026-02-05T10:30:00.000Z"
}

Error Responses

Validation Error (400)

{
  "success": false,
  "error": "productSlug is required"
}
{
  "success": false,
  "error": "emailTitle is required"
}
{
  "success": false,
  "error": "emailBody is required"
}

No Pending Subscribers (400)

{
  "success": false,
  "error": "No pending subscribers found for this product"
}

Authentication Error (401)

{
  "success": false,
  "error": "Unauthorized"
}

Behavior

  1. Validates required fields (productSlug, emailTitle, emailBody)
  2. Fetches all pending subscribers for the specified product
  3. Saves notification history to blob storage for audit trail
  4. Marks all subscribers as “notified” status
  5. Returns notification summary with recipient count

Currently, this endpoint logs the notification and marks subscribers as notified, but does not actually send emails. Email sending via Resend will be implemented in Issue #501. The Resend account and domain verification are complete — only the SDK integration in this function remains.

Email Service

This endpoint will use Resend to deliver emails. Key details:

  • From: Takazudo Modular <notify@takazudomodular.com>
  • Reply-To: takazudo@gmail.com
  • Rate limiting: Batch processing (10 emails per batch, 1 second delay between batches)
  • Error handling: Individual email failures should not stop the batch; failed sends are tracked per recipient

Notification History

Each notification is saved to blob storage with the following structure:

interface NotificationHistory {
  id: string;              // Format: notif_{uuid}
  productSlug: string;
  emailTitle: string;
  emailBody: string;
  recipientEmails: string[];
  sentCount: number;
  timestamp: string;
  status: 'sent' | 'failed';
}

Key pattern: notif-history:{id}