繁体   English   中英

无需使用Cordova插件即可在Ionic 2中发送短信

[英]Send SMS in Ionic 2 without using Cordova Plugins

美好的一天,我想在不使用Cordova SMS插件的情况下自动发送短信。 我希望将验证码发送给每位客户注册后的应用程序。 有什么可行的方法吗? 希望您能够帮助我。 先感谢您。 我正在使用离子2。

如果您有后端运行,这很容易。 本示例将Node与Nexmo SMS API结合使用

app.post('/', (req, res) => {
  res.send(req.body);
  const toNumber = req.body.number;
  const text = req.body.text;
  nexmo.message.sendSms(
    NUMBER, toNumber, text, {type: 'unicode'},
    (err, responseData) => {
      if (err) {
        console.log(err);
      } else {
        console.dir(responseData);
      }
    }
  );
 });

有关完整示例,请参见本文

暂无
暂无

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

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