如何将tropo与node.js-socketstream框架一起使用



在我的应用程序中,使用node.js与socketstream框架。现在我需要使用 tropo 模块发送短信、接收短信、拨打电话和接听来电。我使用 npm.i 安装了 tropo-webapi,我在服务器端添加了这个节点代码。在运行下面的代码时,我没有得到任何输出.我不知道如何在tropo网站中链接此文件以及如何接收短信和电话。

  exports.actions = function(req, res, ss) {
  return{
sendMessage:function(){
    var tropoAPI = require('tropo-webapi');
    var tropo = new tropoAPI.TropoWebAPI(); 
  tropo.call("+18197924547", null, null, null, null, null, "SMS", null,  null,null);
        tropo.say("HI How Are You!!");
    },
makeCall:function(){
      var tropoAPI = require('tropo-webapi');
      var tropo = new tropoAPI.TropoWebAPI(); 
      tropo.call("+18197924547");
      tropo.say("Hi,how ary yoo!");
    }

};

     };

所以你没有指定这个片段来自哪个文件,但我有一种感觉,它来自远程过程调用所在的server/rpc/<yourfilename>下的文件。
!!!注意<yourfilename>

您定义的方法以他可以通过套接字接口触发它的方式为客户端生成,让我写一个片段,我想你会明白的:
- 让我们写入这个文件 => client/code/app/app.js

ss.rpc('<yourfilename>.sendMessage','here comes params which is now a string');

要了解这个ss对象是什么,请查看您的client/code/app/entry.js您将看到它。

最新更新