public void Send(TextMessage message)
        {
            if (!message.IsValid())
                throw new ArgumentException("Invalid Message");

            var http = new HttpClient { Request = { Accept = HttpContentTypes.ApplicationJson } };
            var url = string.Format("http://api.clickatell.com/http/sendmsg?user={0}&password={1}&api_id={2}&{3}&to={4}&text={5}",
                                    _user,
                                    _password,
                                    _apiId,
                                    string.IsNullOrWhiteSpace(_sender) ? null : string.Format("&from={0}", _sender),
                                    HttpUtility.UrlEncode(message.Number),
                                    HttpUtility.UrlEncode(message.Message));
            http.Get(url);
        }
Пример #2
0
 public bool SendTextMessageToContact(Contact contact, string message)
 {
     try
     {
         var number = DetermineMobileNumber(contact.MobileNumber);
         var text = SwapOutPhrases(contact, message);
         var textMessage = new TextMessage(number, text);
         _textingService.Send(textMessage);
         return true;
     }
     catch (InvalidOperationException)
     {
         return false;
     }
 }
 public void Send(TextMessage message)
 {
     if (!_sentSuccessfully)
         throw new InvalidOperationException();
 }
 public void Send(TextMessage message)
 {
 }