Using Twilio with Meteor to respond to SMS - node.js

I have recently started learning how to use node.js and Meteor. I am trying to create a small app that I can query via a client built in meteor, but also query that same MongoDB via SMS using the Twilio API. I can see that this can be done with Express: How can I respond to incoming Twilio calls and SMS messages using node.js? but I wanted to use Meteor because of its apparent ease-of-use and integration with a database. I've been reading various questions about routing templates and serving static html pages in Meteor, but is there a solid way someone think I can make this work? Should I just go back to plain Express?
Twilio expects you to give them the URL where the XML response will be hosted: http://www.twilio.com/docs/quickstart/php/sms/hello-monkey

My earlier response is outdated. Today one should use iron:router and create a server-side route.

Related

How to refresh a React component after a request to backend Node app?

I have an application composed of:
React frontend
Node JS + Express backend
Mongo DB
Backend and frontend communicates mainly through Apollo GraphQL.
Recently I began using Twilio for making calls. After a call, Twilio sends a backend request to my node JS app to a specific route, which is then modyfing a document in Mongo. The request is totally independent of the frontend and can come anytime.
How can I update the React component - a form displaying mentioned document, after that backend request (the displayed data should change accoridng to backend version)? I am thinking about websockets and/or Apollo subscriptions, but maybe there is some easier way?
Twilio developer evangelist here.
You are looking for a way to push data from your server to your front end. Web sockets is probably the best solution for you, and since you are already using Apollo, and Apollo Subscriptions are commonly implemented over web sockets, then that is probably a good solution for you.

Sending and Receiving data from a website to NodeJs application

basically I am trying to figure out a way to make a connection between my Discord Bot and my Website, I have some ideas in mind in using GET and POST methods but IDK how to use them in NodeJs nor in the website as I am still new to it, so what I want is to send a packet of data from the website after a submit button and the bot which is hosted locally with the website will receive this data and work with it.
Express is a commonly used web framework for Node that takes care of routing fairly easily. You can see their documentation here.

Making Firebase and Angular2 project

I'm new at Firebase, I'm starting making a project which has to include Firebase and angular2, but I am such confused about how to implement them. I don't know if a there's the need to have a Back-end implementation (like Java or NodeJs) to handle some security issues (like form validation, authentication, routing etc), or it's enough just implementing Angular2 to handle all these issues. I would be so Thankful about any helpful advice how I could implement these both technologies to build my project successfully. Thanks
first firebase is something like your backend firebase can safe get and send request as your backend apps...
and angular js will do the rest like you just said andd all the backend stuff you can handle by firebase :)
This is my simple explanation on how this 2 works together
Always keep in mind that Angular works only in front-end. Its domain is the look and feel, application events, sending data to server and anything else that has something to do with displaying data is coded in this area.
Backend services in the other hand interacts with your database, creating business logic, handling authentications, saving / sending of data and other stuff that interacts with the database is coded from here.
Now how these two interact is done by the frontend service to send HTTP requests to the Server which is the backend service. This is done by using Angulars $http service or the so called jQuery AJAX or the infamous XMLHttpRequest JavaScript native. New technologies today utilizes Web Sockets which is being used by Firebase and some other frameworks, Web Sockets offers a faster way sending / fetching data from server.
The server then interprets the data being sent and send appropriate response. For example getting user list, saving profile, getting reports, logging in, etc.. It would work in this workflow.
1) Angular sends http request to server to get list of users.
2) Backend service installed in the server then interprets the data being sent.
3) Backend service then gets list of users from the database.
4) Backend then sends the data back to the frontend service.
5) Frontend then recieves server response and displays the data to the view.
Also these two is coded separately. To have more detailed explations research about how frontend and backend services interact you can find so much resouces in Google.

How to connect angular2 server side with php

I recently bought a new template for my site written in angular2, i did a short course on it and started to work and everything fine.
Now come the the part where i try to connect it to my DataBase and i cant figure it out...
after a little bit of reading i saw that i need to use nodejs in order to speak with the server side, is that true?
can i use php or i must use the nodejs api to work with my Db?
am i missing the concept of the angular2 or something? can someone post a basic script of angular working with php example , i just cant find it.. :(
thanks a lot :)
The most common scenario is that you use the Http service in Angular that makes XHR (Ajax) requests to the server to fetch data (not HTML).
You can use any server that is able to receive, process and response to XHR requests. Therefore PHP is as suiteable as node.js (or .NET, Java, or any other web server)
See also https://angular.io/docs/ts/latest/guide/server-communication.html

Sending HTTP request from reactjs/flux to nodejs and sending back HTTP response

Are there are any good simple examples of sending http requests with data from reactjs/flux to nodejs and from the nodejs server sending back an HTTP response with data? I was able to do this in AngularJS with Nodejs since it had a $http service but am confused on how to do this with reactjs. Any help is appreciated.
ReactJS does not come with a http service like you have in AngularJS. That is the way they keep their Library lean.
For making http requests, you can use:
JQuery (Most advised, as its the most used library on the frontend and probably your project or theme is already using it, so no need to include any new library).
Axios, really nice implementation of the Promise API and Client side support for protecting against XSRF (plus supports IE8)
Fetch, built by Github so support is pretty good
Superagent, small, easy to use and easily extensible via plugins

Resources