[英]Unauthorized endpoint, please check Setup->Security->Remote site settings endpoint
我無法通過 Twilio API 發送短信。我收到以下異常:
ERROR: Unauthorized endpoint, 請檢查 Setup->Security->Remote site settings endpoint: url
global class SampleSMSTest {
@future(callout=true)
public static void testsms() {
try {
String account = 'xxxxxxxxx';
String token = 'xxxxxxxxxx';
TwilioRestClient client = new TwilioRestClient(account, token);
Map<String, String> params = new Map<String, String> {
'To' => '+91953835xxxx',
'From' => '+1920569xxxx', // twilio registered number
'Body' => 'Hello there!'
};
TwilioMessage message = client.getAccount().getMessages().create(params);
} catch (Exception e) {
System.debug('Main error==========>' + e);
}
}
}
按照以下路徑在沙箱中添加Twilio URL
Administration Setup > Security Controls > Remote Site Settings > click "**New Remote Site**" button.
我已經解決了我的問題
看起來像Salesforce APEX代碼。 每當您想從Salesforce調用外部URL時,都需要將URL設置為安全的遠程站點。 該錯誤消息告訴您確切的去SF的位置。 將Twilio URL“ api.twilio.com”添加到列表中。
在我的 salesforce 閃電頁面上,我執行了這些步驟。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.