messagebus
v5.0.0
Published
A client for the Message Bus REST API - Version 5
Downloads
12
Readme
###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: "[email protected]",
toName: "Bob",
subject: "Sample Message with HTML body.",
plaintextBody: "This is the plain text body.",
htmlBody: "This is the <b>HTML</b>body.",
fromEmail: "[email protected]",
fromName: "Alice W.",
returnPath: "[email protected]",
sessionKey: sessionKey
}, {
toEmail: "[email protected]",
toName: "John",
subject: "Simple Example with no HTML body.",
plaintextBody: "This is a plaintext example.",
fromEmail: "[email protected]",
fromName: "Alice W.",
returnPath: "[email protected]",
sessionKey: sessionKey
}
];
client.sendMessages(messages, function(err, resp) {
if (err) console.error("Error: %j", err);
else {
console.info("Email send results");
for (var i = 0; i < resp.results.length; i++) {
console.info("To: %s, Message Id: %s, Message Status: %s",
resp.results[i].toEmail, resp.results[i].messageId, resp.results[i].messageStatus);
}
}
});
License
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
http://www.apache.org/licenses/LICENSE-2.0
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