Skip to main content
You can send messages, reply to conversations, and forward emails from your inboxes through the API. All sent messages are tracked within threads alongside received messages, giving you a complete view of each conversation.
Your domain must have sending capability enabled to send messages from inboxes. See add a sending domain to configure your domain.

Send a new message

Send a new email from an inbox. This creates a new thread for the conversation.
import { Nuntly } from '@nuntly/sdk';

const nuntly = new Nuntly({
  apiKey: process.env.NUNTLY_API_KEY,
});

const result = await nuntly.inboxes.send('ibx_01kabn43yqyxn2bx4ve84mczd3', {
  to: [{ address: 'recipient@example.com', name: 'Jane Doe' }],
  subject: 'Welcome to our platform',
  html: '<p>Thanks for signing up. Let us know if you have any questions.</p>',
  text: 'Thanks for signing up. Let us know if you have any questions.',
});

console.log('Message ID:', result.data.id);
console.log('Thread ID:', result.data.threadId);
console.log('From:', result.data.fromAddress);

Send request fields

FieldRequiredDescription
toYesArray of recipient addresses (at least one).
ccNoArray of CC addresses.
bccNoArray of BCC addresses.
subjectYesThe message subject line.
htmlNoThe HTML body.
textNoThe plain text body.
Each address is an object with address (required) and name (optional) fields.

Reply to a message

Reply to a received message. The reply is added to the same thread and automatically sets the In-Reply-To header to link the conversation.
const reply = await nuntly.messages.reply('imsg_01kabn43yqyxn2bx4ve84mczd3', {
  html: '<p>Thank you for reaching out. We will look into this right away.</p>',
  text: 'Thank you for reaching out. We will look into this right away.',
});

console.log('Reply ID:', reply.data.id);
console.log('Thread ID:', reply.data.threadId);

Reply request fields

FieldRequiredDescription
htmlNoThe HTML body of the reply.
textNoThe plain text body of the reply.
replyAllNoSet to true to reply to all recipients. Defaults to false.

Reply all

When you set replyAll to true, the reply is sent to the original sender and all recipients from the original message. Your own inbox address is automatically excluded from the recipient list.
const replyAll = await nuntly.messages.reply('imsg_01kabn43yqyxn2bx4ve84mczd3', {
  html: '<p>Sharing this update with everyone on the thread.</p>',
  text: 'Sharing this update with everyone on the thread.',
  replyAll: true,
});

Forward a message

Forward an existing message to new recipients. This creates a new thread for the forwarded conversation.
const forward = await nuntly.messages.forward('imsg_01kabn43yqyxn2bx4ve84mczd3', {
  to: [{ address: 'colleague@example.com', name: 'John' }],
  text: 'Please take a look at this message from the customer.',
});

console.log('Forwarded message ID:', forward.data.id);
console.log('New thread ID:', forward.data.threadId);

Forward request fields

FieldRequiredDescription
toYesArray of recipient addresses (at least one).
textNoAn optional comment to prepend to the forwarded message.

Response fields

All send, reply, and forward operations return the same response structure:
FieldDescription
idThe ID of the new message.
threadIdThe ID of the thread.
fromAddressThe sender email address.
subjectThe message subject.

Next steps