コンテンツにスキップ

検索はプロダクションビルドでのみ利用可能です。 ローカルでテストするには、サイトをビルドしてプレビューしてください。

メール通知

メール通知は Resend API を使用して、登録されたメールアドレスに通知を送信します。



Bell RPC: registerShopEmailRecipient({
shopId, email, name?,
registeredBy?, registeredByName?
})
フィールド説明
shopId店舗 ID
emailメールアドレス
name受信者名
isActive有効/無効
categoriesカテゴリ設定 (jsonb)
registeredBy登録者 ID

email-sender.ts
const response = await fetch('https://api.resend.com/emails', {
method: 'POST',
headers: {
Authorization: `Bearer ${resendApiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'Speakeasy <notification@plfumg.com>',
to: recipient.email,
subject: title,
html: htmlTemplate,
text: plainTextContent
})
});

通知メールは HTML とプレーンテキストの両方で送信されます。

Subject: 【Speakeasy】{title}
{店舗名} からの通知:
{body}
---
{url ? リンク: url : ''}
受信日時: {YYYY/MM/DD HH:mm} (JST)

受信者ごとにカテゴリの有効/無効を設定できます。

Bell RPC: updateShopEmailCategories({ id, categories })

キューを介さず、直接メールを送信する RPC メソッドも提供されています。

Bell RPC: sendEmailRpc({
to, subject, text?, html?
})
→ { success, error?, messageId? }

用途:

  • パスワードリセットメール
  • テスト通知メール
  • システム管理者への通知

店舗→顧客のメッセージ送信時に、顧客にもメール通知が送信されます。

  1. contact.userId から Vault DB の user.email を取得
  2. contact_purelovers のメール設定を確認
  3. 有効なメールアドレスに送信

Bell RPC: removeShopEmailRecipient({ id })
Bell RPC: sendShopTestNotification({
shopId,
channel: 'email',
targetId: recipientId
})

┌──────────────────────────────────┐
│ メール通知先 │
├──────────────────────────────────┤
│ admin@example.com (管理者) │
│ カテゴリ: [✓ チャット] [✓ 配信] │
│ [テスト送信] [削除] │
├──────────────────────────────────┤
│ staff@example.com │
│ カテゴリ: [✓ チャット] [ 配信] │
│ [テスト送信] [削除] │
├──────────────────────────────────┤
│ メールアドレス: [__________] │
│ 名前(任意): [__________] │
│ [+ 追加] │
└──────────────────────────────────┘