Twilio Request Message

半世苍凉 提交于 2019-12-11 04:44:30

问题


I have configured my endpoint to which twilio will make a request when an SMS is received.

Below is my model which will accept twilio request.

public class TwilioRequest
    {
        public string MessageSid { get; set; }
        public string AccountSid { get; set; }
        public string From { get; set; }
        public string To { get; set; }
        public string Body { get; set; }
        public int NumMedia { get; set; }
        public List<string> MediaContentType { get; set; }
        public List<string> MediaUrl { get; set; }
    }

Below is my WEB API controller

public void POST([FromBody]TwilioRequest request)
        {
            Logger.Info("Hit");
            Logger.Info(string.Format("Account Sid {0}", request.AccountSid));
            Logger.Info(string.Format("Body {0}", request.Body));
            Logger.Info(string.Format("From {0}", request.From));
            Logger.Info(string.Format("MediaContentType {0}", request.MediaContentType));
            foreach (var i in request.MediaContentType)
            {
                Logger.Info(string.Format("MediaContent: {0}", i));
            }
            foreach (var i in request.MediaUrl)
            {
                Logger.Info(string.Format("MediaUrl {0}", i));
            }

            Logger.Info(string.Format("MessageSid {0}", request.MessageSid));
            Logger.Info(string.Format("NumMedia {0}", request.NumMedia));
            Logger.Info(string.Format("To {0}", request.To));
}

But it does not seem that twilio is hitting my end point. I am expecting a json. Kindly advice.

来源:https://stackoverflow.com/questions/38464416/twilio-request-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!