Node.js integration with MS Exchange EWS [closed] - node.js

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am attempting to use Node.js to call the SOAP Exchange EWS services. I have created a simple http client like so:
var https = require('https');
var username = 'user';
var password = 'password';
var auth = 'NTLM ' + new Buffer(username + ":" + password).toString('base64');
var options = {
host : 'exchangehost',
port : 443,
method : 'post',
path : '/Exchange.asmx',
headers : { Authorization : auth }
};
var request = https.request(options, function(response) {
console.log('Status: ' + response.statusCode);
};
request.write('<soapenv:Envelope ...></soapenv:Envelope>');
request.end();
I receive a status code 401, I suspect because I am not doing the three steps involved for NTLM authentication (http://www.innovation.ch/personal/ronald/ntlm.html). Does anyone know of a Node.js module for communicating with Exchange EWS directly or for authenticating using NTLM, or am I going to need to implement that protocol for Node.js myself? Any assistance is greatly appreciated.

I have used node-ews successfully to communicate with EWS.
node-ews uses httpntlm internally for NTLM authentication.
Personally, I think node-ews is your best bet, since its pretty much already implemented everything you need to interact with EWS.

Have you tried the httpntlm module? https://github.com/SamDecrock/node-http-ntlm

Have you tried ews-javascript-api npm module, it has all the features you are looking at + very simple ntlm authentication using ews-javascript-api-auth module. NTLMv2 is also supported.
I added this as answer as it would provide complete answer to question title (integration). These are github links, question is little generic so samples provided at github readme should work.
[disclaimer - I am the author]

I've found this one Node.js module that supports communicating with Exchange 2010, however I'm still trying to figure out how to use it personally, the documentation is light.
https://npmjs.org/package/exchanger

Related

I am having a problem with the frontend request is not connected to the backend API [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 days ago.
Improve this question
I am having a problem with the frontend request is not connected to the backend API
enter image description here
``
`.ENV FILE
`JWT_SECRET = '55ffv4sf54f5b5f4b54dfb25fd4b5rf325b4s57r\gw5rfs2h45'
MAIL_PW ='jubril2010'
MAIL_USER ='olanrewajubril#gmail.com'
NODE_ENV = production
PORT = 3005
MONGO_URI ='mongodb://localhost:27017/loanify_db'
MONGO_URI_DEV ="mongodb://127.0.0.1:27017/loanify_db"
SMTP_SERVICE= email
IF I SIGNUP ON THE LOAN WEBSITE PAGE IT RESPOND AS (Something went wrong!)
I am having a problem with the frontend request is not connected to the backend API
[enter image description here](https://i.stack.imgur.com/InP9Q.png)
.ENV FILE
`JWT_SECRET = '55ffv4sf54f5b5f4b54dfb25fd4b5rf325b4s57r\gw5rfs2h45'
MAIL_PW ='jubril2010'
MAIL_USER ='olanrewajubril#gmail.com'
NODE_ENV = production
PORT = 3005
MONGO_URI ='mongodb://localhost:27017/loanify_db'
MONGO_URI_DEV ="mongodb://127.0.0.1:27017/loanify_db"
type here
SMTP_SERVICE= email`
``
IF I SIGNUP ON THE LOAN WEBSITE PAGE IT RESPOND AS (Something went wrong!)

How do I get my ExpressJS/NodeJs backend to work with HTTPS? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 22 days ago.
Improve this question
I'm currently working on deploying a fullstack webapp to DigitalOcean, where I have 2 docker images - One for the frontend to statically serve files, and an ExpressJS backend that handles any logic for API calls. I have recently added CloudFlare to my website, which has enabled HTTPS, and while that is progress, now my backend is no longer responsive from the domain when doing HTTPS, if i access it by going to my droplet's ip(unsecure, HTTP) I can see that my api requests are working, but on the main HTTPS site, the entire backend is unresponsive.
I am currently mapping my frontend to port 80 outside of the docker container (from port 3000 inside) and 3001:3001 for my backend. I've heard that I should maybe use nginx, but I'm unsure how that works with my 2 docker images, and I've tried to use https.createServer(options, app) to try to get it to listen for the HTTPS requests, but to no avail.
Here is my current backend now:
const express = require("express");
const webserver = express();
const cors = require("cors");
const mysql = require("mysql");
// Connection pool here
webserver.use(cors());
webserver.use(express.json());
const PORT = 3001;
//api routes here
webserver.listen(PORT, () => {
console.log(`[Express] Server running on ${PORT}`);
});
Any step in the right direction would be much appreciated, I've been researching how to fix this for ~10 hours with no luck.
Edit: I believe the solution is not to change the Express server to allow HTTPS, but somehow have Nginx do a reverse proxy and convert it to HTTP before it even hits the Express server, but I am unsure of how this is done.
Instead of app.listen() or with your variable naming webserver.listen(), you have to manually create the server instance using https.createServer() and pass it the security credentials for your https server:
const https = require('https');
const express = require("express");
const app = express();
const server = https.createServer({
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
}, app);
server.listen(443);
Relevant https doc here and Express doc here.

How to build a Dialogflow chatbot for website? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I want to run my first, simple chatbot on my website. So I chose that stack:
Dialogflow (ML, AI etc.)
Dialogflow Messeger (frontend communicator app)
Firebase Functions with Dialogflow Fulfillment Library (backend)
I noticed that Dialogflow Fulfillment Library is no longer maintained. And for example quick replies (rich message) works on Dialogflow Console, but doesn’t work on Dialogflow Messenger.
My code (fulfillment webhook):
const functions = require('firebase-functions');
const { WebhookClient } = require('dialogflow-fulfillment');
const { Suggestion } = require('dialogflow-fulfillment');
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
let intentMap = new Map();
intentMap.set('richmessage', richMessageButtonHandler);
function richMessageButtonHandler(agent) {
agent.add('Select one');
agent.add(new Suggestion('Quick Reply'));
agent.add(new Suggestion('Suggestion'));
}
agent.handleRequest(intentMap);
});
Question: I need simple chatbot for website with quick replies (suggestions). Can I achieve that with these technologies (without Facebook Messenger or other external service)? Is any successor? Some alternatives?
Thanks in advance!
DialogFlow is a good platform (free, NL capabilities, multi-channels) but it is not ideal for web sites, or at least it does not have a specific browser widget.
The DialogFlow web demo is meant for development/testing and cannot be easily customised. There are some options out there (Kommunicate, BotCopy) to add a webchat plugin for a web site or alternatively using the SDK you can build the web chat frontend you want (similar as dialogflow-web-v2 on GitHub)
If you want to make your BOT part of an Omnichannel platform you can go with Kommunicate. That is the one I'm using it at the moment. BotCopy just integrate your chat into a web page but without the omnichannel capability or, the hardcore one, develop your own with node.js or angular.js etc. You can try also Twilio Flex but it requires other intermidiate components.
Try Rasa also (https://rasa.com/)
positives
free
opensourse
privacy
negative
need a system resource to run and train bot

Is node.js Express 4.x suitable for making web api's now vs alternative node packages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I know there are alternatives such as restify but would like to stick with the more familiar express. Does anyone have examples (and or experience/tips to share) of successful implementations of a web api with Express 4.x, such that I could forgo having to go down an alternative route?
restify uses very similar patterns to express for routing, etc., so if you plan on doing any fancy API stuff you might as well just npm install restify and use it in place of express. Here's a minimal example of a restify application from its homepage:
var restify = require('restify');
function respond(req, res, next) {
res.send('hello ' + req.params.name);
next();
}
var server = restify.createServer();
server.get('/hello/:name', respond);
server.head('/hello/:name', respond);
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});
On the flipside, it's not like express has any specific disadvantages in terms of usage for APIs (and performance may actually be better, looking around at other StackOverflow questions). If you don't need any of the features that restify provides and express doesn't, and you have no plans for using them in the future, then you may as well just stick with express. It's all a matter of your needs for your API, really; there are plenty of other questions on StackOverflow regarding restify vs. express for specific cases, so take a look around at what information is already available.

Which websocket library to use with Node.js? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Currently there is a plethora of websocket libraries for node.js, the most popular seem to be:
https://github.com/Worlize/WebSocket-Node
https://github.com/einaros/ws
https://github.com/LearnBoost/engine.io
https://github.com/learnboost/socket.io
https://github.com/sockjs
However I can't find any solid concrete comparisons between any of them...
Apparently Socket.io was awesome, but has become quite dated and has failing builds. Both ws and websocket-node claim they are the fastest. And engine.io seems new, but a lot heavier than the lighter aletarntives.
It would be amazing if we or someone could put together an answer that serves as a guide on which socket library to use and when, as well as a comparison between them.
Getting the ball rolling with this community wiki answer. Feel free to edit me with your improvements.
ws
WebSocket server and client for node.js. One of the fastest libraries if not the fastest one.
websocket-node
WebSocket server and client for node.js
websocket-driver-node WebSocket server and client protocol parser node.js - used in faye-websocket-node
faye-websocket-node WebSocket server and client for node.js - used in faye and sockjs
socket.io
WebSocket server and client for node.js + client for browsers + (v0 has newest to oldest fallbacks, v1 of Socket.io uses engine.io) + channels - used in stack.io. Client library tries to reconnect upon disconnection.
sockjs
WebSocket server and client for node.js and others + client for browsers + newest to oldest fallbacks
faye WebSocket server and client for node.js and others + client for browsers + fallbacks + support for other server-side languages
deepstream.io clusterable realtime server that handles WebSockets & TCP connections and provides data-sync, pub/sub and request/response
socketcluster WebSocket server cluster which makes use of all CPU cores on your machine. For example, if you were to use an xlarge Amazon EC2 instance with 32 cores, you would be able to handle almost 32 times the traffic on a single instance.
primus Provides a common API for most of the libraries above for easy switching + stability improvements for all of them.
When to use:
use the basic WebSocket servers when you want to use the native WebSocket implementations on the clientside, beware of the browser incompatibilities
use the fallback libraries when you care about browser fallbacks
use the full featured libraries when you care about channels
use primus when you have no idea about what to use, are not in the mood for rewriting your application when you need to switch frameworks because of changing project requirements or need additional connection stability.
Where to test:
Firecamp is a GUI testing environment for SocketIO, WS and all major real-time technology. Debug the real-time events while you're developing it.
Update: This answer is outdated as newer versions of libraries mentioned are released since then.
Socket.IO v0.9 is outdated and a bit buggy, and Engine.IO is the
interim successor. Socket.IO v1.0 (which will be released soon) will
use Engine.IO and be much better than v0.9. I'd recommend you to use
Engine.IO until Socket.IO v1.0 is released.
"ws" does not support fallback, so if the client browser does not
support websockets, it won't work, unlike Socket.IO and Engine.IO
which uses long-polling etc if websockets are not available. However,
"ws" seems like the fastest library at the moment.
See my article comparing Socket.IO, Engine.IO and Primus:
https://medium.com/p/b63bfca0539
npm ws was the answer for me. I found it less intrusive and more straight forward. With it was also trivial to mix websockets with rest services. Shared simple code on this post.
var WebSocketServer = require("ws").Server;
var http = require("http");
var express = require("express");
var port = process.env.PORT || 5000;
var app = express();
app.use(express.static(__dirname+ "/../"));
app.get('/someGetRequest', function(req, res, next) {
console.log('receiving get request');
});
app.post('/somePostRequest', function(req, res, next) {
console.log('receiving post request');
});
app.listen(80); //port 80 need to run as root
console.log("app listening on %d ", 80);
var server = http.createServer(app);
server.listen(port);
console.log("http server listening on %d", port);
var userId;
var wss = new WebSocketServer({server: server});
wss.on("connection", function (ws) {
console.info("websocket connection open");
var timestamp = new Date().getTime();
userId = timestamp;
ws.send(JSON.stringify({msgType:"onOpenConnection", msg:{connectionId:timestamp}}));
ws.on("message", function (data, flags) {
console.log("websocket received a message");
var clientMsg = data;
ws.send(JSON.stringify({msg:{connectionId:userId}}));
});
ws.on("close", function () {
console.log("websocket connection close");
});
});
console.log("websocket server created");

Resources