当前位置: 首页>>代码示例>>C#>>正文


C# TwilioResponse.Message方法代码示例

本文整理汇总了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);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:13,代码来源:example-1.4.x.cs

示例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);
 }
开发者ID:sturobo,项目名称:TreasureHint,代码行数:8,代码来源:TestTwimlController.cs

示例3: Can_Generate_Single_Message

        public void Can_Generate_Single_Message()
        {
            var response = new TwilioResponse();
            response.Message("Hello world");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:7,代码来源:MessageTests.cs

示例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()));
        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:10,代码来源:MessageTests.cs

示例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()));
        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:12,代码来源:MessageTests.cs

示例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());
            }
        }
开发者ID:sturobo,项目名称:TreasureHint,代码行数:21,代码来源:TextMessageController.cs

示例7: GenerateTwiML

 private TwiMLResult GenerateTwiML(string message)
 {
     var response = new TwilioResponse();
     response.Message(message);
     return TwiML(response);
 }
开发者ID:brentschooley,项目名称:marketing-notifications-csharp,代码行数:6,代码来源:NotificationsController.cs

示例8: Index

 public ActionResult Index(SmsRequest request)
 {
     var response = new TwilioResponse();
     response.Message("The Robots are coming! Head for the hills!");
     return TwiML(response);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:6,代码来源:generate-twiml-sms.4.x.cs

示例9: Respond

        private static TwilioResponse Respond(string message)
        {
            var response = new TwilioResponse();
            response.Message(message);

            return response;
        }
开发者ID:TwilioDevEd,项目名称:airtng-csharp,代码行数:7,代码来源:ReservationsController.cs

示例10: IDontKnowYou

 private TwilioResponse IDontKnowYou()
 {
     TwilioResponse resp = new TwilioResponse();
     resp.Message("Sorry, I don't know who you are!");
     return resp;
 }
开发者ID:sturobo,项目名称:TreasureHint,代码行数:6,代码来源:TextMessageController.cs


注:本文中的Twilio.TwiML.TwilioResponse.Message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。