Create a REST-ful api in Node.js for notifications - node.js

I'm a newbie in Node.js and after doing initial learning on Node.js, I find it rather confusing to find out any best practices. My project requires to build a real-time notification system such that, when something happens at the server side or any of the connected clients, a notification can pop up at all connected clients. I couldn't find any official recommendations on what's the best approach and tools to take. I saw there are various frameworks written in Node.js seem able to do the job, but I'm hoping some one can give me some direction.
Thank you in advance.

Start with Angularfire if you want to code less.
You can create real-time apps without a backend part like so: https://github.com/tastejs/todomvc/blob/master/examples/firebase-angular/js/app.js
Note, this is a Q&A site. Ask a question next time. "Please direct me" is not allowed to ask here.

Related

How should I build this app over communcation apps?

These days I am finding myself in the position of having to implement for one of my college courses a system that should act as a giant wrapper over many communications apps like Gmail , Facebook Messenger maybe even WhatsApp .To put it simply you should have a giant web interface where you can authorize Gmail , Messenger and use them at once when required. I am thinking of going with an REST API to manage the user's services authorized by OAuth2.Also I am thinking of using Node.JS and Express.js in the backend and React.js in the frontend. I found some sweet libraries in npm that should take care of interacting with the involved APIs(https://www.npmjs.com/package/node-gmail-api this one for instance), but I am also doubtful about this approach , for example I have no idea how to keep the use notified about its incoming mails or messages for example . I am in dire need of some expertise since I forgot to mention but I am quite the newbie in this field. To sum it up for once my question is how would you implement such an infrastructure ? Is it my approach viable or I am bound to hit some really hard to overcome obstacles?
As a college exercise, it would be a really fun experiment, so it definitely worth the time you want to put into it. However, once you want to add more features, the complexity will go up pretty fast.
Here are a couple of ideas you can think of:
It's pretty clear that your system can't do more things than the capabilities exposed by the APIs of communication apps (e.g. you can't have notifications in gmail if the API doesn't have this capability).
For that reason, you should carefully study the APIs and what functionalities they expose. They have public docs that you can check out: (Gmail API, Facebook Messanger API)
Some of the apps you want to communicate with may not have an official API (e.g. WhatsApp) - those kinds of details you definitely want to know from the start.
Based on the analysis of those APIs, you should lay out a list of requirements for your system, which can be extracted from all the APIs, for example: message notifications, file transfers, user profiles, etc.
In this way, you know exactly what capabilities your system should have, and you don't end up implementing a feature that is available only in 1 API out of 4.
Also, it would be a bit challenging to design your system from a user perspective, because the apps have different usage patterns - chat apps, where messages are coming in real-time, vs email, which is not real-time communication. That's just a detail anyway, the gist of your project is to play with those APIs.
Also, it may worth checking out the Gateway Aggergation Pattern, which is related to this project - you may want the user to send a message to multiple apps, by using a single request to your service.

NooB Alert NodeJs and Slack Bot build. Need Advice

Prewarning: I am a noob with development, I started doing web design when I retired from the Marines about 3 years ago. I specialized in Intelligence and Tactics, so not a computer user during that career. Fast forward to Today:
I work as an Exchange admin and migration specialist with GoDaddy, I have been through several Webdesign courses and learned a decent foundation of html/css/php however JavaScript, Nodejs, Java, Python, C++, and C# are all still things I am working on.
My issue: My lead wants to have a bot built that essentially posts messages in the #general group (I learned how to do this and actually setup a nodejs server within my test hosting server # GD and have a Joke bot running in my slack WS). The tricky part that I have been scratching my brain on is how to use an web API that GD has to monitor our call que, hold times, and agents online. I need to figure out how to get the bot to post a message regarding certain triggers automatically(exp. Hold time exceeds 10mins). I can not figure out whether to use a webhook, eventListener, or a direct bot auth'd into the GD api like my joke bot that links to chuckNorris jokes.
I appreciate all the comments truly, I have thick skin and know that I am late to the game on development. I want to build this for the experience and to integrate with slack, my end goal would be more projects to eventually become a Dev within GD.
I have a few thoughts that might help you.
Regarding these holdtimes, agents online, and call queues, think of these as events. Whenever these events occur, they should fire a payload (HTTP request) to your service that then posts messages to slack. I think you might need a slack bot token for this.
Many APIs have this functionality under webhooks. You provide them the URL to the endpoint your developing and theres usually a toggle to tell them that you want to start accepting events.
To get going on your service/bot, I'd recommend starting with learning about what these webhook event payloads will look like in terms of structure so that you can parse it.
If you have more detailed questions feel free to comment or message. Happy to help. I've written a slack bot or two.

Facebook like notifications with node

I kept searching for a tutorial that explains the logic behind facebook notifications (or any similar notifications system) and I couldn't really find any that approach this.
I mean those notifications with a dropdown that say "X commented on your picture" and so on.
How would you guys build such a feature with node? (socket.io?) What would you store in the database? If someone can give me some references would be great.
I never did a notification system to be honest, but as far as I know, yes, sockets (and for node specifically, socket.io, it's the only one I know) can allow you to do that easily, you should look at their basic documentation to learn more about it and understand how it can be done, and yes you can at the same time as notifying the user about the like, store it in a database for further reference, you can store the time, the profile who liked the post, the ID of the post, this kind of things.
Hope I'm clear and that you will find socket.io documentation easy enough to build your notification system!

NodeJS and multiple mini programs

I know that this question is going to slightly broad and it is a development theory question.
But I have a client who wants the ability for one nodejs application to be able to host multiple mini programs inside of it using the same structure as the parent nodejs. Without giving too much away, the theory is there is one platform and experimenters could post their experiments and run those experiments within the application in the form of modules. Sorta like cloud9 in theory but with experiments. I will be using shortcodes within the application as room name for socket.io to have the ability to chat within an experiment.
Does anybody have an ideas or could point me to a place where there is something for this? (I will clarify any questions you may have about this project in the comments.)
Thanks for your feedback

Bidding agent using node.js for RTBkit

With the RTBkit real-time-bidding kit for advertising, you can write your own agents in C++. But it also says you can write agents in node.js.
How would you do this?
A wiki page describes exactly what you are trying to do. Did you try to follow the explanations ?
RTBKit also contains an example of a bidding agent written in Node.js. I think that both the wiki page and the example should be a good start and you should quickly be able to write your bidding agent in Node.js
Finally, note that RTBKit has a public mailiing list for all the questions you could have. The list is quite active and the questions generaly find a fast answer. That might also help you if you start playing with RTBKit.
Enjoy !

Resources