node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป


MB icon

Message Bus Node.js sdk

Message Bus is a cloud-based platform for easily sending email at scale and with complete insight into your messaging traffic and how recipients are responding to it. All platform functions are available via REST API as well as the language-specific documentation, sample code, libraries, and/or compiled binaries contained in this SDK.

Samples include how to:

  • Create sessions
  • Send messages
  • Use templates
  • Use webhooks

If you have questions not answered by the samples or the online documentation, please contact support.

Installing the module

npm install messagebus

Sending emails

var client = new MessageBusAPIClient('apiKey');
var sessionKey = "DEFAULT";

var messages = [{
        toEmail: "",
        toName: "Bob",
        subject: "Sample Message with HTML body.",
        plaintextBody: "This is the plain text body.",
        htmlBody: "This is the <b>HTML</b>body.",
        fromEmail: "",
        fromName: "Alice W.",
        returnPath: "",
        sessionKey: sessionKey
    }, {
        toEmail: "",
        toName: "John",
        subject: "Simple Example with no HTML body.",
        plaintextBody: "This is a plaintext example.",
        fromEmail: "",
        fromName: "Alice W.",
        returnPath: "",
        sessionKey: sessionKey

client.sendMessages(messages, function(err, resp) {
    if (err) console.error("Error: %j", err);
    else {"Email send results");
        for (var i = 0; i < resp.results.length; i++) {
  "To: %s, Message Id: %s, Message Status: %s",
                resp.results[i].toEmail, resp.results[i].messageId, resp.results[i].messageStatus);


Copyright (c) 2014 Mail Bypass, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License