public HttpResponseMessage SendText(TextMessage model)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemResponse<bool> response = new ItemResponse<bool>();

            _userService.SendTextMessage(model);

            return Request.CreateResponse(response);
        }
예제 #2
0
        public void SendTextMessage(TextMessage model)
        {
            List<User> list = new List<User>();

            list = GetConfirmedPhones();

            var twilio = new TwilioRestClient(_AccountSid, _AuthToken);

            foreach (var item in list)
            {
                string phoneWithCode = "+1" + item.Phone;

                var message = twilio.SendMessage(_TwilioNumber, phoneWithCode, model.Message);

                TextMessageLogInsert(item.UserId, item.Phone, null, model.Message);
            }
        }