如何在使用Swift的iOS应用程序中使用plivo SMS API。我阅读了很多关于这方面的文档。我不知道如何在swift上实现它。使用Plivo API从iOS应用程序发送短信
var plivo = require('plivo');
var p = plivo.RestAPI({
authId: 'Your AUTH_ID',
authToken: 'Your AUTH_TOKEN'
});
var params = {
'src': '1111111111', // Sender's phone number with country code
'dst' : '2222222222', // Receiver's phone Number with country code
'text' : "Hi, text from Plivo", // Your SMS Text Message - English
//'text' : "こんにちは、元気ですか?", // Your SMS Text Message - Japanese
//'text' : "Ce est texte généré aléatoirement", // Your SMS Text Message - French
'url' : "http://example.com/report/", // The URL to which with the status of the message is sent
'method' : "GET" // The method used to call the url
};
// Prints the complete response
p.send_message(params, function (status, response) {
console.log('Status: ', status);
console.log('API Response:\n', response);
console.log('Message UUID:\n', response['message_uuid']);
console.log('Api ID:\n', response['api_id']);
});
上面的代码是在Node.js的,我想它的迅速写入,同时还我不知道如何plivo集成到iOS应用。我正在开发一个应用程序,当用户请求订单时,它应该向用户发送短信。所以我只想从Plivo传出的消息给管理员。任何建议都非常有用。
一个类似的例子(尽管不使用plivo):bit.ly/2fw6fN1 –