Resonator is a NodeJS microservice with built-in logic to send email, SMS and push notifications in an easy manner.
git clone https://github.com/nick13jaremek/resonator.git
There exist two main data models that Resonator uses to send notifications.
The Identity schema models a user object which stores the relevant data for Resonator to be able to send the desired notifications.
The schema includes the following fields:
The Channel schema models a channel object that can be used to create filtered groups of target Identities. Instead of specifying an array of Identities, Resonator can specify a Channel object that the Identities belong to, and send notifications to the channel members.
The Channel schema includes the following fields:
Transport modules allow Resonator to send different notification types.
Email notifications are sent on top of the
mailgun npm module. In order to use it, two items need to be set in the Resonator configuration file:
You may obtain valid
domain items by creating an account in the Mailgun website.
Alternatively, instead of hard-coding the credentials in the Resonator configuration file, you can export them as environmental variables in your local
machines by using the names specified in the
custom-env-variables configuration file.
SMS notifications are sent on top of the
twilio npm module. Before using it, some credential items need to be added to the Resonator configuration file, namely:
You may obtain valid account_sid and auth_token values by creating an account in the Twilio website.
Alternatively, you may export these items as environmental variables in your local machine by using the names specified in the
custom-env-variables configuration file.
Push notifications are powered via the
node-gcm npm modules. Both modules require a set of credentials to be set in the Resonator configuration.
apnmodule, a private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data is needed. See the apn documentation for reference.
node-gcmmodule, a Google api key is needed in order to send push notifications to Android devices. You may export the
GOOGLE_API_KEYenvironment variable on your local machine. Check the Resonator configuration files for more information.
Resonator has been developed with the intention of reusing its services in different projects, each one requiring some of the available notification transports. Depending on the project, the complexity associated to integrating Resonator may be lower or higher. Here is a brief description of the steps to set up Resonator with some project of your own:
Please, check the Resonator Apiary file to check the available endpoints, request body formats and response cases.
Resonator includes integration tests via CucumberJS and unit tests via Mocha. You may run each set of tests by using the
npm test-cucumber and
npm test-mocha respectively.
In order to run all tests, use the
npm test command.
If you spot any bug or missing functionality, feel free to open a new issue or a pull request.
New logic should include the corresponding tests to ensure the consistency of the project's code.
The Apiary documentation should reflect the changes performed on the existing endpoints or on the new ones.
The MIT License (MIT)
Copyright (c) 2015 The Game of Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.