在不使用科尔多瓦插件的情况下在Ionic 2中发送短信
问题描述:
好日子,我想在不使用Cordova SMS插件的情况下自动发送短信。我想在注册该应用程序之后将验证码发送给每位客户。有没有办法做到这一点?希望您能够帮助我。先谢谢你。我正在使用Ionic 2。在不使用科尔多瓦插件的情况下在Ionic 2中发送短信
答
如果您有一个后端运行,那很容易。本示例使用节点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);
}
}
);
});
查看this article的完整示例。
有没有什么方法可以使用插件而无需打开消息应用程序(自动发送短信)。 – Patrick