如何在使用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 –