React native 如何使用React Native通过Twilio发送短信(SMS)?
如何使用Twilio和native react发送短信 我使用此代码,但不起作用:React native 如何使用React Native通过Twilio发送短信(SMS)?,react-native,twilio,twilio-api,React Native,Twilio,Twilio Api,如何使用Twilio和native react发送短信 我使用此代码,但不起作用: fetch('https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxx/Messages', { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json',
fetch('https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxx/Messages',
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
user:'ACxxxxxxxxxxxxxxxxxxxxxxx',
password:'f8xxxxxxxxxxxxxxxxxxxxxx',
to: '+3933850xxxx',
body: 'test',
from: '+3933850xxxx',
}),
});
还有其他方法吗?使用twilioAPI发送消息的示例代码 示例代码
你读过API文档吗?@Andrea你能分享一些相同的例子吗?这里的上下文是什么?
const twilioClient = context.getTwilioClient();
twilioClient.messages
.create({ from: context.PHONE_NUMBER, to: phoneNumber, body: message })
.then(x => {
// If the SMS was successfully sent, remove the item from the list
return twilioClient.sync
.services(event.ServiceSid)
.syncLists(event.ListUniqueName)
.syncListItems(orderNumber)
.remove();
})