0.3.2 • Published 9 years ago

venn-messaging v0.3.2

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Venn Email

Codeship Status for VennHQ/venn-email-node

Build in a redundant messaging service seamlessly. If your email, sms or push notification provider goes down, we'll fall back to a secondary service.

Installation

npm install venn-messaging

Email

initialize(api_key)

paramstypedescriptionexample
api_keyStringVenn API Key64d2fa24h3f6f7cc61asp3e8

send(data, callback)

paramstypedescriptionexample
data.fromStringfrom email addressfrom@email.com
data.toStringto email addressto@email.com
data.subjectStringemail subjectSubject 123
data.messageStringemail messageHow you doin?

Example

vennEmail = require("venn-messaging").Email;

// initialize and send an email
vennEmail.initialize(VENN_API_KEY);

var data = {
	from: "from@email.com",
	to: "to@email.com",
	subject: "Subject 123",
	message: "How you doin?"
};

vennEmail.send(data, function(err, result){
	// email successfully sent if no error
});

SMS

initialize(api_key)

paramstypedescriptionexample
api_keyStringVenn API Key64d2fa24h3f6f7cc61asp3e8

send(data, callback)

paramstypedescriptionexample
data.fromStringfrom phone number+14354402246
data.toStringto phone number+1633050227
data.messageStringtext messageHow you doin?

Example

vennSms = require("venn-messaging").SMS;

// initialize and send an SMS
vennSms.initialize(VENN_API_KEY);

var data = {
	from: "+14356650499",
	to: "+14503350029",
	message: "How you doin?"
};

vennSms.send(data, function (err, result) {
	// text successfully sent if no error
});

Push Notification

initialize(api_key)

paramstypedescriptionexample
api_keyStringVenn API Key64d2fa24h3f6f7cc61asp3e8

send(data, callback)

paramstypedescriptionexample
data.deviceTokenStringid of target deviceFE66489F304DC75B8D6E8200DFF8
data.deviceTypeStringtype of target deviceios
data.messageStringnotification messageHow you doin?

Example

vennPush = require("venn-messaging").Push;

// initialize and send a push notification
vennPush.initialize(VENN_API_KEY);

var data = {
	deviceToken: "FE66489F304DC75B8D6E8200DFF8",
    deviceType: "ios",
    message: "How you doin?"
};

vennPush.send(data, function (err, result) {
	// push notification successfully sent if no error
});

Development

Install Dependencies

npm install

Export Environment Variables

VENN_API_KEY="h41fa6602663b30c78b9c339"
VENN_API_URL="http://localhost:3400/v1"

Run Examples

node examples/example.js 

Run Examples with Debugging

VENN_API_KEY=5f6abf85d1947ce29ce7332f
VENN_API_URL=http://localhost:3400/v1
DEBUG="venn"
node examples/example.js

Run Tests

mocha

Adding a New Service Provider

  1. Write Failing Tests
  2. Create a new test file of the form test/service_type/service_name/error.js
  3. Copy test/template/test_service_template.js into this new file
  4. Follow instructions in the template file to create tests for the new service
  5. Create the New Service Provider
  6. Install the service provider's npm package as a dependency
  7. Create a new file of the form lib/models/providers/service_type/service_name.js
  8. Copy lib/models/providers/template/service_template.js into this new file
  9. Follow instructions in the template file to create the new service
  10. Edit lib/models/messaging_client.js
  11. Require the newly created service provider
    var ServiceName = require('./providers/service_type/service_name');
  12. Add the newly created service provider to initServices
    else if (property === "service_name" && keys[property]) {
    	messagingProvider = new ServiceName(keys[property]);
    }
  13. Add api key validator to Venn API
0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago