本文整理汇总了C#中Twilio.TwiML.TwilioResponse.Message方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.Message方法的具体用法?C# TwilioResponse.Message怎么用?C# TwilioResponse.Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwiML.TwilioResponse
的用法示例。
在下文中一共展示了TwilioResponse.Message方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
public ActionResult Index(SmsRequest request)
{
var response = new TwilioResponse();
if(request.body == "hello")
{
response.Message("Hi!");
}
else if(request.body == "bye")
{
response.Message("Goodbye");
}
return TwiML(response);
}
示例2: Get
// GET: api/TestTwiml
public HttpResponseMessage Get(TwilioRequest req)
{
TwilioResponse res = new TwilioResponse();
res.Message("Hello There", new {voice = "alice"});
return Request.CreateResponse(HttpStatusCode.OK, res.Element);
}
示例3: Can_Generate_Single_Message
public void Can_Generate_Single_Message()
{
var response = new TwilioResponse();
response.Message("Hello world");
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例4: Can_Generate_Single_Message_With_Attributes
public void Can_Generate_Single_Message_With_Attributes()
{
var response = new TwilioResponse();
response.Message(
"Hello world",
new { to = "+15551111111", from = "+15552222222", action = "sms.php", method = "GET", statusCallback = "status.php" }
);
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例5: Can_Generate_Single_Message_With_Media
public void Can_Generate_Single_Message_With_Media()
{
var response = new TwilioResponse();
response.Message(
new string[] {
"http://example.com/1",
"http://example.com/2" },
new { to = "+15551111111", from = "+15552222222", action = "sms.php", method = "GET", statusCallback = "status.php" }
);
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例6: GetMessage
private HttpResponseMessage GetMessage(SmsRequest req)
{
try
{
using (TreasureContext db = new TreasureContext())
{
User user = _userService.GetUserFromPhoneNo(req.From, db);
if (user == null) return Request.CreateResponse(HttpStatusCode.OK, IDontKnowYou().Element, new XmlMediaTypeFormatter());
TwilioResponse result = _storyTellerService.ReadStory(user, req.Body, req.To);
db.SaveChanges();
return Request.CreateResponse(HttpStatusCode.OK, result.Element, new XmlMediaTypeFormatter());
}
}
catch (Exception e)
{
TwilioResponse resp = new TwilioResponse();
resp.Message(e.Message);
return Request.CreateResponse(HttpStatusCode.OK, resp.Element, new XmlMediaTypeFormatter());
}
}
示例7: GenerateTwiML
private TwiMLResult GenerateTwiML(string message)
{
var response = new TwilioResponse();
response.Message(message);
return TwiML(response);
}
示例8: Index
public ActionResult Index(SmsRequest request)
{
var response = new TwilioResponse();
response.Message("The Robots are coming! Head for the hills!");
return TwiML(response);
}
示例9: Respond
private static TwilioResponse Respond(string message)
{
var response = new TwilioResponse();
response.Message(message);
return response;
}
示例10: IDontKnowYou
private TwilioResponse IDontKnowYou()
{
TwilioResponse resp = new TwilioResponse();
resp.Message("Sorry, I don't know who you are!");
return resp;
}