简体   繁体   English

我如何在Node.js中使用tropo模块?

[英]How can i use tropo module with node.js?

在我的应用程序中,我需要将tropo应用程序与node.js一起使用,以发送,接收消息以及拨打电话和接听电话。我看到了文档,但我一无所知。有人可以帮助我。

Disclaimer - I have never worked with tropo, but this is how I understand it works: 免责声明-我从未使用过tropo,但这是我理解它的工作方式:

  1. You write a script that tropo can parse, in most languages, to perform some function. 您使用大多数语言编写了tropo可以解析的脚本,以执行某些功能。
  2. You link up that script to a number using tropo's web interface. 您可以使用tropo的网络界面将该脚本链接到一个数字。
  3. You / a client phones that number, tropo fetches your script and executes it. 您/客户拨打该号码,然后tropo提取脚本并执行。

Here is a full walkthrough of how everything above works: https://www.tropo.com/docs/scripting/creating_first_application.htm 这是上述所有内容的完整演练: 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: 为此,您可以使用node.js:

  1. You write a script that changes based on time / user data in node.js 您在node.js中编写了一个根据时间/用户数据而变化的脚本
  2. You link up the script using tropo's web interface. 您可以使用tropo的网络界面链接脚本。
  3. When someone calls / texts the number, tropo now fetches the dynamic script from your node.js server. 当有人打电话/发短信给该号码时,tropo现在会从您的node.js服务器获取动态脚本。

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 此node.js api可用于在节点服务器上编写脚本: 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. 此时,您将使用REST API来自动执行以前必须在tropo网站上手动执行的“号码挂钩工作”。 You can use any node REST client, like request to do this. 您可以使用任何节点REST客户端,例如request来执行此操作。 Here are the API docs: https://www.tropo.com/docs/rest/rest_api.htm 以下是API文档: https : //www.tropo.com/docs/rest/rest_api.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM