Messaging

Messages

Learn about Nuvix messages, the different types of messages, what can be sent in different message types.

Each time you send or schedule a push notification, email, or SMS text, it's recorded in Nuvix as a message and is displayed in the Messages tab.

Messages overview interface

Messages overview

Each message displays with the following information.

ColumnDescription
Message IDThe unique ID of the message.
DescriptionThe developer defined description of the message. End users do not see this description.
MessageThe message delivered to end users.
TypeType of message, either Push, Email, and SMS.
StatusIndicates the status of the message, can be one of draft, scheduled, processing, failed, success.
Scheduled atIndicates the scheduled delivery time of the message.
Delivered atIndicates the time at which the message was successfully delivered.

Message types

There are three types of messages

Message typeDescription
Push notificationsPush notifications are alerts that show up on a user device's notification center. This can be used to deliver messages to the user whether their application is open or not.
EmailsEmails let you deliver rich content to a users' inbox. Nuvix allows you to send customized HTML email messages so you can include links, styling, and more.
SMSSMS messages let you deliver text messages to your user's phone. This helps you reach your user, even when their device do not have internet access.

Messages lifecycle

Messages can begin as a draft, or proceed directly to processing if it's sent immediately. If the message is scheduled to be sent later, its status is set to scheduled, then to processing at schedule time. After attempted delivery, it is marked as sent or failed depending on if the message was successfully delivered.

Message lifecycle status flow

Choosing a message type

Choosing the right type of notification to reach your audience is important for your app's success. Here are some common factors to consider when deciding what type of message should be sent.

Message typeDescription
Time-sensitive messagesPush notifications or SMS messages are ideal for time-sensitive messages, as they are typically checked frequently and opened within minutes, ensuring prompt attention.
Guaranteed deliveryEmails and SMS messages are more reliable for guaranteed delivery of important messages like invoices and order confirmations, as push notifications can be easily missed.
Content-rich messagesEmails are best suited for delivering content-rich messages like promotional letters, detailed updates, and newsletters, thanks to support for HTML, allowing for rich text, links, and styling.
Increasing engagementPush notifications are effective for increasing engagement with users, as they can be clicked on to link directly to your app, promoting immediate interaction.
Accessibility and reachEmails and SMS messages allow you to reach users even before they have installed your app, making them suitable for announcement-type messages that require broad accessibility.

Composing messages

Different types of messages have different content and configurable options. Here are the different components that make up a message.

ParameterRequiredDescription
messageIdrequiredThe title of the push notification. This is the headline text that recipients see first.
titleoptionalThe title of the push notification. This is the headline text that recipients see first. Can be omitted for background notifications.
bodyoptionalThe main content or body of the push notification. Provides the details or message you want to convey. Can be omitted for background notifications.
dataoptionalExtra key-value pairs that apps can use to handle the notification more effectively, such as directing users to a specific part of the app.
actionoptionalSpecifies which activity or view controller to open within the app when the notification is tapped.
iconoptionalSets the icon of the notification, used only for Android devices. This can help in branding the notification.
soundoptionalSets the sound to use for the notification. For Android, the sound file must be located in /res/raw; for Apple devices, it must be in the app's main bundle or the Library/Sounds folder of the app container.
coloroptionalSpecifies a color tint for the notification icon, used only for Android devices. This can be used to align with brand colors.
tagoptionalCan be used to replace an existing notification with the same tag, used only for Android devices. Useful for updating or canceling notifications.
badgeoptionalSets the number to display next to the app's icon, indicating the number of notifications or updates. Setting to 0 removes any existing badge. Must be an integer. For Apple devices only.
contentAvailableoptionalFor iOS devices only. When set, wakes up the app in the background without showing a notification. Used to update app data remotely. Requires priority to be set to normal. Note: APNS may throttle if sending more than 2-3 background notifications per hour. For Android, similar functionality can be achieved by sending a data-only notification without title and body.
criticaloptionalFor iOS devices only. Marks the notification as critical to bypass silent and do not disturb settings. Requires the app to have the critical notification entitlement from Apple.
priorityoptionalSets notification priority to normal or high. Normal priority delivers at the most convenient time based on battery life and may group notifications. High priority delivers immediately.
draftoptionalIf the message is a draft, can be true or false.
scheduledAtoptionalAn ISO date time string specifying when the push notification should be sent.
ParameterRequiredDescription
subjectrequiredThe subject line of the email. This is what recipients see first in their inbox.
contentrequiredThe main content of the email. This can be plain text or HTML, depending on the html flag.
ccoptionalAn array of target IDs to be included in the carbon copy (CC) field. These recipients can see each other's email addresses.
bccoptionalAn array of target IDs to be included in the blind carbon copy (BCC) field. These recipients cannot see each other's email addresses.
htmloptionalA boolean indicating whether the content is in HTML format. This allows for rich text, links, and styling in the email content.
draftoptionalIf the message is a draft, can be true or false.
scheduledAtoptionalAn ISO date time string specifying when the email should be sent.
ParameterRequiredDescription
contentrequiredThe main content of the SMS. This should be concise and clear, as SMS messages have character limits.
draftoptionalIf the message is a draft, can be true or false.
scheduledAtoptionalAn ISO date time string specifying when the SMS should be sent.

Sending a message

You can create a message with a Server SDK. You can send a push notification like this.

import { Client } from '@nuvix/client';

const nx = new Client()
  .setEndpoint('https://api.nuvix.in/v1')
  .setProject('<PROJECT_ID>')
  .setKey('<API_KEY>');

const message = await nx.messaging.createPush(
  '<MESSAGE_ID>',
  '<TITLE>',
  '<BODY>',
  [],
  [],
  [],
  {},
  '<ACTION>',
  '<ICON>',
  '<SOUND>',
  '<COLOR>',
  '<TAG>',
  1,
  false,
  false,
  'normal',
  true,
  ''
);

Learn more about sending push notifications

You can send an email like this.

import { Client } from '@nuvix/client';

const nx = new Client()
  .setEndpoint('https://api.nuvix.in/v1')
  .setProject('<PROJECT_ID>')
  .setKey('<API_KEY>');

const message = await nx.messaging.createEmail(
  '<MESSAGE_ID>',
  '<SUBJECT>',
  '<CONTENT>',
  [],
  [],
  [],
  [],
  [],
  true,
  false,
  ''
);

Learn more about sending email messages

You can send an SMS message like this.

import { Client } from '@nuvix/client';

const nx = new Client()
  .setEndpoint('https://api.nuvix.in/v1')
  .setProject('<PROJECT_ID>')
  .setKey('<API_KEY>');

const message = await nx.messaging.createSms(
  '<MESSAGE_ID>',
  '<CONTENT>',
  [],
  [],
  [],
  true,
  ''
);

Learn more about sending SMS messages

How is this guide?

Last updated on

Messages