我想實現使用第三方API的發送消息功能。 API- https://api.txtlocal.com/send/如何使用textlocal API發送短信..?
但是當我們測試實現時,我們遇到了錯誤代碼3的問題,並給出了一條消息作爲「無效的用戶細節」。
發現下面的C#代碼:
string UserId = "1234";
String message = HttpUtility.UrlEncode("OTP");
using (var wb = new WebClient())
{
byte[] response = wb.UploadValues("https://api.txtlocal.com/send/", new NameValueCollection()
{
{"username" , "<TextLocal UserName>"},
{"hash" , "<API has key>"},
{"sender" , "<Unique sender ID>"},
{"numbers" , "<receiver number>"},
{"message" , "Text message"}
});
string result = System.Text.Encoding.UTF8.GetString(response);
//return result;
錯誤詳細信息:
{
"errors": [{
"code": 3,
"message": "Invalid login details"
}],
"status": "failure"
}
即使我路過的有效憑證。
請幫助我,讓我知道,以防您需要任何更多的細節。
非常感謝,並提前感謝您的幫助。
我絕不會使用第三方api發送機密信息。寧願使用我自己的電子郵件服務器以郵件形式發送消息。 – jdweng
@jdweng你怎麼知道這是保密信息,OP想發送? – derpirscher
@jdweng我同意您的反饋,但客戶自身要求使用此第三方在成功註冊到系統後發送短信。 –