Skip to main content

Managing Notification Messages

Ductape lets you manage notification messages across all your channels—push, email, callbacks, and more. Notification messages help you keep users informed about important events in your product, and you can easily create, update, and fetch them using the SDK.

Note: Notification message tags should follow the format notificationTag:messageTag (for example, notify-users:new-message). This keeps your tags organized and prevents conflicts across different notifiers and messages.

What Are Notification Messages?

Notification messages are reusable templates that define how you communicate with users for specific events. Each message can include content for multiple channels (push, email, callback, SMS), making it easy to keep your notifications consistent and manageable.

Notification Message Structure

FieldTypeDescription
_idObjectId (optional)Unique identifier (auto-generated)
namestringDisplay name for your message
tagstringUnique tag for this message (see note above)
descriptionstringShort description of what this message is for
push_notificationobject (optional)Push notification template (see push docs)
push_notification_dataarray (optional)Data samples for push notification
emailobject (optional)Email template (see email docs)
email_dataarray (optional)Data samples for email
callbackobject (optional)Callback template (see callback docs)
callback_dataarray (optional)Data samples for callback
smsstring (optional)SMS template (see SMS docs)
sms_dataarray (optional)Data samples for SMS

Creating a Notification Message

To create a notification message, use the create function from the product.notifications.messages interface:

const message = await ductape.product.notifications.messages.create({
name: "New Notification",
tag: "notify-users:new-message",
description: "Notify customer of great things",
push_notification,
callback,
email,
sms,
});

Updating a Notification Message

To update an existing notification message, use the update function:

const updatedMessage = await ductape.product.notifications.messages.update("notify-users:new-message", {
push_notification,
callback,
email,
sms,
});

You can update any of the fields or channels as needed.

Fetching Notification Messages

To get all messages in a notification category, use the fetchAll function:

const messages = await ductape.product.notifications.messages.fetchAll("notify-users");

Fetching a Single Notification Message

To get a specific message by its tag, use the fetch function:

const message = await ductape.product.notifications.messages.fetch("notify-users:new-message");

Key Points:

  • Notification messages are reusable templates for all notification channels.
  • Tags should be unique and follow the notificationTag:messageTag format.
  • Each message can include templates for push, email, callback, and SMS.
  • Data samples help you test and preview your templates.

Next Steps: