How can i use tropo module with node.js? - node.js

In my application i need to use tropo application with node.js to send,receive message and call and answer phone calls.I saw the documentation but i didn't get any idea.Can anyone help me.

Disclaimer - I have never worked with tropo, but this is how I understand it works:
You write a script that tropo can parse, in most languages, to perform some function.
You link up that script to a number using tropo's web interface.
You / a client phones that number, tropo fetches your script and executes it.
Here is a full walkthrough of how everything above works: https://www.tropo.com/docs/scripting/creating_first_application.htm
NOW, if you want your script to do dynamic things, you need to host it yourself. For this you can use node.js:
You write a script that changes based on time / user data in node.js
You link up the script using tropo's web interface.
When someone calls / texts the number, tropo now fetches the dynamic script from your node.js server.
This node.js api can be used to write scripts on your node server: https://github.com/tropo/tropo-webapi-node, https://www.tropo.com/docs/webapi/new_tropo_web_api_overview.htm
Finally, you might want to dynamically create different scripts for different users and hook them up to individual numbers. At this point you use the REST API to automate the "number hooking up work" you used to have to do manually on tropo's website. You can use any node REST client, like request to do this. Here are the API docs: https://www.tropo.com/docs/rest/rest_api.htm

Related

How to execute shell scripts on the backend of a nodejs web app?

I have a full stack MERN application running on a google compute engine, along with a local mongodb running on the same server. Its a CRUD application, however, I have a script that is stored in the server that I would like triggered everytime a user presses a button on the front end. (a use case would be, user enters some input that is logged into the database, and when its logged I would like a script triggered on the backend that creates a json file out of the mongodb table and uploads it to github/emails it out).
I'm not sure where to start learning this, a few google searches have led me to AJAX and child_processes, am I going in the right direction? Any resources or pointers would be great. Thank you
If I understood the question correctly then you want to accomplish the following things:
1. Export json data from a local MongoD instance.
2. Then send that data to github or email it somewhere.
In that case I would recommend to use child process(exec, spawn, execFile, fork) to execute the mongoexport command to get .json files.
But I don't recommend using shell script to upload that data to github or email it.
Use the github api for github and use node-mailer to email the data.
To learn more about child processes read the docs here Node.js v14.x Child process docs

How can I call web python script to get HTTP response value with GET?

What is the simplest way for making a Python script run in a webserver and allow me to call it passing a parameter and grabbing the value that the script ends up with?
I am thinking that this is what is normally refered to as an API, but not sure how to implement this in the most simple way.
The application from which I would be calling this python script is ManyChat, through its feature "external requests" which allows me to use GET or POST parameters, but I don't know how I would turn my python script into a web queriable api.
https://support.manychat.com/support/solutions/articles/36000018457-dev-tools-external-request-and-dynamic-block-
I took a look online and found some articles about Python + Flask but it seems a solution for scenario where SQL database is involved in the operations. However my python script will NOT need to communicate with any SQL database so I am wondering if there is a simpler solution
Flow control could be as follows:
Flask app running on /api on your web server
Client app does requests.get('myserver.com/api?p1=v1&p2=v2')
Flask app handles request and runs function under #app.route('/api')
Client app receives response

Use nodeJS server with symfony

I have a huge symfony app and I wanted to add some feature that I could only do with a nodeJS server .
So I have a big JSON file which result from my nodeJS run, this file have to go in Symfony.
And symfony have to be able to send some pdf file to the node server (the one which will be transform in JSON by my node server).
Is anyone have some starting idea ?
thansk for help :D
No one is going to be able to provide a full answer with so few details, but generally speaking messaging and remote procedure calls are excellent for interop between parts of a large app.
You could send a message from Symfony (which includes the path of the PDF, or the contents itself), and node will provide the result. You can encode that as JSON, and send it as an answer.
RabbitMq is widely supported, allows both produce-consume or RPC-style use.

Map integration in MEAN STACK

I want to integrate a google map in my page. That it should be able to find the user's current location and send the data back. Since am using node I didn't get any good reference for that!
So kindly suggest me some best solutions or good refernce
since your are using angular , you can find plenty of google map modules in gihtub . angular Ui is a set of modules that will speed up your developement process, it already includes google map directive and other directives which you can use in your app
here is how to use it :
http://angular-ui.github.io/angular-google-maps/#!/use
for sending the data back to node (express) , you have multiple options : socket io if you are using it , or a simple http post to your server will do the trick
just remember to use promise to wait for the data before you send it.
hope it helps!

Google apps script in HTML

Is it possible to use google apps script in my HTML? I want to be able to write to a spreadsheet from a form in purely Javascript from an external framework such as Node.js.
https://developers.google.com/apps-script/
Google Apps Script's syntax is Javascript, however it is a unique server-side framework that does not behave as a library to applications outside of the Apps Script servers. (No, you won't be able to use Google Apps Script in your node.js app.)
However, that doesn't mean that your node.js app (or any other app on the web) can't interact with your spreadsheet. For instance, your app could authenticate as you using the OAuth API, then access the spreadsheet through the Google Drive API. For an example of this, see Accessing Google Spreadsheets from Node.js
Alternatively, you could roll your own spreadsheet API in Google Apps Script, to support read / write of your sheet via HTTP requests from your node.js app. There are plenty of examples of that, for example Insert new rows into Google Spreadsheet via cURL/PHP - HOW?.
Sure you can. You can use HtmlService to create your web form, then send the submission data to your Spreadsheet with server functions.
Nowadays you could use the Google Apps Script API to call your Google Apps Script code from other platforms like Node.js, actually the official docs include a quickstart for Node.js.
You can you use HtmlService, but maybe can be helpfull to read the Google Hosted Libraries https://developers.google.com/speed/libraries/
To use a Javascrtip library inside GAS, I recommend JQuery.
But Maybe, you can use Node.js inside your external website and make a AJAX Request (get or post) to a GAS and return from GAS this:
ContentService.createTextOutput(e.parameter.callback + "("+Utilities.jsonStringify(JSONDATA)+")").setMimeType(ContentService.MimeType.JSON);
After that, process it inside your AJAX request...
Mogsad is right that you might be better of with Google Drive API to interact with your Spreadsheet!
...But depending on your exact need you might have some possible interaction between external service and google apps scrip using Content service Google Dev link.
Content Service can send back several information upon GET request (ATOM, CSV, ICAL, JAVASCRIPT, JSON, RSS, TEXT, VCARD, XML). By playing around with url parameters you can get information out and in a spreadsheet, send an email, trigger some action etc!.
But that is far from a real external library and direct interaction with server side functions!

Resources