notifme / notifme-sdk Goto Github PK
View Code? Open in Web Editor NEWA Node.js library to send all kinds of transactional notifications.
Home Page: https://notifme.github.io/www/
License: MIT License
A Node.js library to send all kinds of transactional notifications.
Home Page: https://notifme.github.io/www/
License: MIT License
when using require to import 'notifme-sdk' an error occur when trying to create a client.
the solution for me was:
const NotifmeSdk = require("notifme-sdk").default;
If I want to supply a custom header, will I have to implement a custom email handler, or does SMTP provider have this functionality?
Hello,
I am having the following issue when I try to run the project after adding NotifmeSDK in my fresh new Node js project.
TypeError: NotifmeSdk is not a constructor
at
index.mjs:3:20
at ModuleJob.run (node:internal/modules/esm/module_job:175:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
A step by step guideline would have been helpful.
I have a project setup with typescript, jest and using notifme-sdk for notifications.
Running yarn jest
command is giving below error.
TypeError: Cannot read property 'levels' of undefined
at Object.patchedCreate [as createLogger] (D:\workspace\iq\app\node_modules\diagnostic-channel-publishers\dist\src\winston.pub.js:110:35)
at new Logger (D:\workspace\iq\app\node_modules\notifme-sdk\lib\util\logger.js:25:42)
at Object.<anonymous> (D:\workspace\iq\app\node_modules\notifme-sdk\lib\util\logger.js:65:19)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Module._compile (D:\workspace\iq\app\node_modules\pirates\lib\index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at newLoader (D:\workspace\iq\app\node_modules\pirates\lib\index.js:104:7)
at Object.newLoader [as .js] (D:\workspace\iq\app\node_modules\pirates\lib\index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at Module.patchedRequire [as require] (D:\workspace\iq\app\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (D:\workspace\iq\app\node_modules\notifme-sdk\lib\sender.js:43:15)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Module._compile (D:\workspace\iq\app\node_modules\pirates\lib\index.js:99:24)
GitHub has issued a security advisory for node-fetch. Please upgrade the node version to 2.6.1.
Thanks!
when I import the package and use it as written in the readme file .. it throws this error:
TypeError: NotifmeSdk is not a constructor
(+) 1 vulnerability found
Prototype pollution attack
Name: hoek
CVSS: 4 (Medium)
Installed: 2.16.3
Vulnerable: <= 4.2.0 || >= 5.0.0 < 5.0.3
Patched: > 4.2.0 < 5.0.0 || >= 5.0.3
Path: [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > [email protected]
More Info: https://nodesecurity.io/advisories/566
Telegram its opensource and very used, i think it would be a good alternative for secure and cheap notifications.
Just curious if any plan to support template management. This would allow template management and from SDK users can only pass template id and variables.
I would be interested to support this.
I am surprised to see Messenger not supported
Some of the missing channels seem to be supported by botkit (FB Messenger, Hangouts, MS Teams etc). Is an integration doable ? Any tips, pros n cons ?
The SMS/Voice from number should be a a string|function
.
Why? When using a strategy (such as fallback) the from number will likely be tied to a provider. For example you might have one number for Twilio and another number for Plivo. Additionally this configuration should not be moved to the provider since it would be naive to assume that you only have 1 number you can send from in any Provider (aka you could have multiple numbers in Twilio). Therefore because of these reasons the from phone number should either be a string or a function that returns the string.
Proposed example:
import NotifmeSdk from 'notifme-sdk'
const dynamicFromNumber = function(provider){
switch(provider.type){
case "twilio": return "555-555-5555";
case "plivo": return "444-444-4444";
}
}
const notifmeSdk = new NotifmeSdk({}) // empty config = all providers are set to console.log
notifmeSdk
.send({sms: {from: dynamicFromNumber, to: '+15000000001', text: 'Hello, how are you?'}})
.then(console.log)
Can we add database channel ? So I can save notifications in my DB through this.
need to change the baseURL from api.mailgun.net
to api.eu.mailgun.net
when the domain is tagged as "EU" else API results with a 404 Domain not found
This package has a dependency towards [email protected] which has an upstream vulnerability towards nodemailer: https://www.npmjs.com/advisories/1708
The vulnerability has been fixed upstream by [email protected] so it could be desired to release a new version of this package bumping that dependency.
Hello is there a Nestjs Wrapper for Notifme?. Or can you optionally give me pointers on how to implement this in Nestjs?
I think if you guys provided a way to add providers via NPM, it would be great. My case for it is AWS services like SES (Simple E-mail Service) and SNS (Simple Notification Service, for SMS).
I was going to add AWS SDK but adding stuff to package.json
to add providers seems not be scalable. Of course, AWS API works with HTTP calls but I for one don't have any experience with that.
If you agree, I would love to help making notfme extendable and discuss the best way to implement it.
Hi,
I'm trying to have multiple providers, and trying to give different from
emails for each of them.
here is what i'm trying:
{
type: "smtp",
pool: true,
host: config.SMTP.HOST,
port: 465,
secure: true, // use TLS
auth: {
user: config.SMTP.USER,
pass: config.SMTP.PASSWORD
}
},
{
type: "sendgrid",
apiKey: config.SENDGRID
}
]
can i pass from
field in each provider here in above segment?
right now i'm passing it inside
notifmeSdk
.send({
...payload
})
but in this way, i'm only able to send email with single provider, as for me every email provider is having different from
emails.
I'd like to know if this project still maintained and worked on.
Thank you very much!
Hi, Could we get slack notifs as well?
I suppose we could do it with a custom webpush provider atm, right?
Hi, please give us an API to add new vendors for SMS and mail integration.
which version of node notifme supports?
Make generic the strategy attached to a channel.
The idea is to be able to define a function implementing the strategy. A strategy takes all provider in input and return a "new" provider.
channels {
sms: {
providers: [...]
multiProviderStrategy: string /* actual*/
| (SmsProviderInstance[]) => ((req) => Promise<string>)
}
}
Refactor existing strategies would be easy
fallback : (providers) => // try with the first and recursively try on error
round-robin (no-fallback) : (providers) => provider[n]
Queue logic complexifies this library. Let's extract it in an extension.
I'm looking at this exciting tool your team has been working on and hoping to adopt it, however I have a question after reading through the documentation.
Is there any way to tie this into my web-app? I saw web-push but wasn't entirely sure how this works?
Essentially I would like to have something similar to facebook or google plus as an option where I Have a bell that a user can click to view their notification history after the webpush has happened and be able to query their own personal notification history on a specific channel.
Is this something that exists? How would this work?
I didn't see any GET or websocket option in the documentation. If this is something that could be voted for I would cast my vote :)
I could see this as somekind of websocket provider
channel: My-App-Push-Channel -> (Store value for Later GET) -> Websocket Gateway -> App Subscribed to websocket gateway.
Hey, this library looks great at first look! Thanks to the authors for getting this together!
I'd like to vote for Sendgrid.
I need multiple notifications (Twilio + Sendgrid) for an upcoming project and would love to give this library a try. I may take a crack at a PR in the coming weeks if I can squeeze it in.
Hi, I was trying to send a mult-ichannel notification. 1st channel is sending the notification, however, rest of the channels are not sending any notifications.
This package has a dependency towards [email protected]
which has an upstream vulnerability towards node-forge: https://www.npmjs.com/advisories/1561
The vulnerability has been fixed upstream by [email protected]
(latest release being [email protected]
)
Would it be possible to release a new version of this package bumping that dependency, to fix this vulnerability issue?
I have no experience with that dependency myself, but it is not a major release so I am expecting such a bump to be straightforward...?
In node-fetch, we can pass a http.Agent
with custom proxy settings in options with node-https-proxy-agent.
So maybe we can set http/https proxy settings in option from NotifmeSdk or read from environment variables like http_proxy and https_proxy, then all providers just read this option and pass it to node-fetch
.
As in readme file I made changes to code.When I run the code with yarn run notifiction catcher
as mentioned in readme file I am getting errors regarding yarn.So that I run the code with yarn run run-catcher then in terminal I am getting this
**
yarn run v0.27.5
$ notification-catcher
NotificationCatcher webapp running at http://0.0.0.0:1080
NotificationCatcher SMTP Server running at 0.0.0.0:1025
**
When I run the following url in my browser http://localhost:1080 I am getting notifme page but I am not getting a message(as shown in readme file) which I am sending in code.
Hi,
I have a slack application that my customers install in their workspace, and I want to send them messages using notifme-sdk, how can I configure this?
Hi, I used this package for notification feature but when I tried to require const NotifmeSdk = require("notifme-sdk").default;
and called new NotifmeSdk({}), I cannot lift the sailjs app. I got this error {"code":"include-all:COULD_NOT_REQUIRE","raw":{},"filepath":"/home/nguyenhung/Documents/Git/notifier/api/controllers/noti/async.js","level":"error","message":"Failed to lift app:","severity":"error"}.
I think the reason is es6 syntax. How can I resolve this?
Thank you.
callbacks and errbacks are not nice, they happen out of context making it difficult to react differently on each send request.
IMHO rather than a global callback/errback, the send() method should return a Promise that resolves with the result of rejects with an Error (or custom Error child depending the failure).
Please add support for https://www.mailgun.com/ email provider
This is caused by a dependency in node-pushnotifications -> wns
Avoid using git dependencies and projects using git dependencies
npm WARN addRemoteGit at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
npm WARN addRemoteGit at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
npm WARN addRemoteGit at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:114:15)
npm WARN addRemoteGit git://github.com/alex-friedl/wns.git#660afd2 resetting remote /home/trooper/.npm/_git-remotes/git-github-com-alex-friedl-wns-git-660afd2-6861c264 because of error: { Error: not found: git
npm WARN addRemoteGit at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
npm WARN addRemoteGit at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
npm WARN addRemoteGit at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
npm WARN addRemoteGit at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:114:15) code: 'ENOGIT' }
The current (1.4.0) notifme-sdk is caught by nsp due to https://nodesecurity.io/advisories/534
For sure, the root cause is node-gcm, but notifme-sdk get the nsp blame :-)
npm i nsp
nsp check --output summary
(+) 1 vulnerabilities found
Name Installed Patched Path More Info
debug 0.8.1 >= 2.6.9 < 3.0.0 || >= 3.1.0 [email protected] > [email protected] > [email protected] > [email protected] https://nodesecurity.io/advisories/534
If you provide some guidance, I'd be happy to create a PR to implement this.
There is a SparkPost transport for nodemailer if that makes it easier.
This library looks promising! This is a vote for a Microsoft Teams push connector.
I when using FCM push Please help me for id params in the config. What is the value for id
in the below fcm. I tried secret server key and other keys bit I am not sure
new NotifmeSdk({
channels: {
push: {
providers: [{
type: 'fcm',
id: 'xxxxx'
}]
}
}
})
Shouldn't gcm
be changed to fcm
in this file?
notifme-sdk/src/providers/push/fcm.js
Line 11 in 7fd02c8
Changing it to fcm
fixes my issue after migrating to the HTTP v1.
Thanks
It seems that the library never attachements
to the notification catcher : https://github.com/notifme/notifme-sdk/blob/master/src/providers/email/notificationCatcher.js#L8
Is this a expected behavior even if its defined as available in the request : https://github.com/notifme/notifme-sdk/blob/master/src/models/notification-request.js#L17
Regards
I would like to see if there are other people interested in adding more channels, in this case I believe that Telegram would be nice to have, please upvote if you are interested
Telegram is not recognized as a channel.
I used a library called node-telegram-bot-api to actually send the message to a telegram user and added it as a custom provider to the configuration of NotifmeSdk, the problem I noticed is that telegram is not a recognized channel, but if you give it recognized channel name (ex: email, sms, voice...etc) it will work, but this is not a good solution.
bot.on('message', (msg) => {
const chatId = msg.chat.id;
contactName = msg.chat.name // supposing you are storing this variable somewhere
console.log(chatId)
});
bot.sendMessage(chatId,
Hi ${contactName}!);
add telegram as a channel type.
I want to replace winston with pino logger http://getpino.io/#/, which is much faster than winston. Can I use my own pino instance with notifme?
Hi Team,
I wasn't able to figure out how to send an FCM notification to a device group. Any help would be greatly appreciated? FWIW, the underlying library used (https://github.com/ToothlessGear/node-gcm) supports sending to device groups.
Thanks,
Thanks for your great sdk.
Just an idea :
BroidHQ (https://github.com/broidHQ/integrations) is powerful SDK to manage conversions with messaging platforms like slack etc, why not use this lib for : "Add other types of notifications based on what people ask"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.