Skip to main content

Notifications

Send notifications to users via push, email, SMS, or webhooks.

Quick Example

// Send an email notification
await ductape.notifications.send({
env: 'prd',
product: 'my-app',
event: 'welcome_email',
input: {
to: 'john@example.com',
subject: 'Welcome!',
body: 'Thanks for signing up.'
}
});

Notification Types

TypeWhat it doesUse cases
PushReal-time device notificationsAlerts, updates, promotions
EmailMessages to user inboxesAccount info, transactions
SMSText messages to phonesOTPs, alerts, status updates
WebhookHTTP callbacks to external systemsIntegrations, automation

Setting Up Notifications

Push Notifications

await ductape.notifications.create({
name: 'Order Update',
tag: 'order-update',
type: 'push',
// ... provider config
});

Email Notifications

await ductape.notifications.create({
name: 'Welcome Email',
tag: 'welcome-email',
type: 'email',
// ... provider config
});

SMS Notifications

await ductape.notifications.create({
name: 'OTP Code',
tag: 'otp-code',
type: 'sms',
// ... provider config
});

Webhooks

await ductape.notifications.create({
name: 'Order Webhook',
tag: 'order-webhook',
type: 'webhook',
// ... provider config
});

Best Practices

  • Use clear, actionable language
  • Personalize with user-specific data
  • Test in development before production
  • Respect user opt-in/opt-out preferences
  • Monitor delivery metrics

See Also