[英]Sending SMS through Twilio and C#
We are building a ASP.NET MVC app, which requires SMS integration. 我们正在构建一个需要SMS集成的ASP.NET MVC应用程序。 I have downloaded the latest pre-release (through nuget) and used the source code as mentioned in API section.
我已经下载了最新的预发行版(通过nuget),并使用了API部分中提到的源代码。 However, it seems to have an issue
但是,这似乎有一个问题
var message = twilio.SendMessage(...);
Console.WriteLine(message.Sid);...
Where the Sid
is not available in the message
object. Sid
在message
对象中不可用的地方。 Instead I am using Status
. 相反,我正在使用
Status
。
The actual problem is when I try to send as per the guidelines and API tokens available in the SMS testing page, I got the message.Status as "Faulted" and no SMS was sent. 实际的问题是,当我尝试按照SMS测试页面上的指南和API令牌进行发送时,收到消息。状态为“错误”,并且没有发送SMS。 Even I tried with the test page @ https://www.twilio.com/user/account/developer-tools/api-explorer/message-create , that too didn't send a message indeed.
即使我尝试使用测试页面@ https://www.twilio.com/user/account/developer-tools/api-explorer/message-create ,也确实没有发送消息。
Is there anything I am missing? 有什么我想念的吗?
Twilio evangelist here. Twilio福音传教士在这里。
What .NET version is your application? 您的应用程序是哪个.NET版本? The pre-release nuget package includes two different assemblies, one for .NET 4 and greater, one for .NET 3.5.
预发行的nuget软件包包括两个不同的程序集,一个用于.NET 4及更高版本,一个用于.NET 3.5。
If your project is using .NET 4 or greater all of the library methods are new async, so your call to send message would look like: 如果您的项目使用的是.NET 4或更高版本,则所有库方法都是新的异步方法,因此您发送消息的调用应类似于:
var result = await twilio.SendMessage(...);
Console.WriteLine(result.Sid);
Hope that helps. 希望有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.