c# - Twilio SMS messaging not working in Console Application -


i funded twilio account , working in console application. when go documentation (here: https://www.twilio.com/user/account/developer-tools/api-explorer/message-create) , enter phone number request works. however, when copy code local console application nothing happens. literally copy code line line , make sure sid, token, , numbers correct , nothing happens @ all, console app runs end of execution.

string accountsid = "mysid"; string authtoken = "myauthtoken"; var twilio = new twiliorestclient(accountsid, authtoken); var message = twilio.sendsmsmessage("+12222222222", "+13333333333","hello world"); console.writeline(message.sid); 

i run fiddler , raw packet. fiddler says result 401 status code.

post https://api.twilio.com/2010-04-01/accounts/mysid/sms/messages.json http/1.1 authorization: basic {tonsofrandomcharactersthatlooklikeishouldhide} accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml accept-charset: utf-8 user-agent: twilio-csharp/3.4.1.0 (.net 4.0.30319.17929) content-type: application/x-www-form-urlencoded host: api.twilio.com content-length: 56 accept-encoding: gzip, deflate connection: keep-alive

from=%2b14697891380&to=%2b12146630105&body=new%20message

any ideas on going one? know others having issue, see posted in other places, have yet see response.

also here link person having issue. comment, not have reputation enter comment, hence why made thread (why twilio not sending sms?)

i unable twilio work, not answer technical issues (i think reason twilio has not authorized account), of prototyping , need asap ended using plive , has call , text message working within hour. here sample code , cheaper twilio. twilio , have used in past, never c#. maybe can still issue resolved asap.

using system; using system.collections.generic; using system.reflection; using restsharp; using plivo.api;  namespace plivo2 {     class program     {         static void main(string[] args)         {              string auth_id = "myauthid";  // obtained plivo account dashboard             string auth_token = "myauthtokey";  // obtained plivo account dashboard              // making call             string from_number = "myplivenumber";             string to_number = "thenumberyouwanttocontact";              sendmessage(auth_id, auth_token,  from_number,  to_number,"hello world!");          }          private static void callphone(string auth_id,string auth_token, string fromnumber, string tonumber){              // creating plivo client             restapi plivo = new restapi(auth_id, auth_token);              irestresponse<call> response = plivo.make_call(new dictionary<string, string>() {                 { "from", fromnumber },                 { "to", tonumber },                  { "answer_url", "http://some.domain.com/answer/" },                  { "answer_method", "get" }             });              // "outbound call" api response has 4 properties -             // message, request_uuid, error, , api_id.             // error - contains error response sent server.             if (response.data != null)             {                 propertyinfo[] proplist = response.data.gettype().getproperties();                 foreach (propertyinfo property in proplist)                     console.writeline("{0}: {1}", property.name, property.getvalue(response.data, null));             }             else                 console.writeline(response.errormessage);          }          private static void sendmessage(string auth_id,string auth_token, string fromnumber, string tonumber, string message) {               restapi plivo = new restapi(auth_id, auth_token);              irestresponse<messageresponse> resp = plivo.send_message(new dictionary<string, string>()              {                 { "src", fromnumber },                 { "dst", tonumber },                 { "text", message },                 { "url", "http://some.domain/receivestatus/" },                 { "method", "get" }             });             if (resp.data != null)             {                 propertyinfo[] proplist = resp.data.gettype().getproperties();                 foreach (propertyinfo property in proplist)                     console.writeline("{0}: {1}", property.name, property.getvalue(resp.data, null));             }             else                 console.writeline(resp.errormessage);         }       } } 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -