Exemplo n.º 1
0
        public IHttpActionResult SendTestSms(SendSmsRequest request)
        {
            TwilioSmsService twilioSms        = new TwilioSmsService();
            List <String>    recipientNumbers = new List <string>();

            recipientNumbers.Add(request.To);
            IEnumerable <String> resp = twilioSms.SendSms(request.From, recipientNumbers, request.MessageBody, System.Configuration.ConfigurationManager.AppSettings["smsAccountSid"], System.Configuration.ConfigurationManager.AppSettings["smsAuth"]);

            return(Ok(new SendSmsResponse()
            {
                Data = resp,
                Success = Common.Enumerations.ResponseStatus.Succeeded
            }));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Environment.CurrentDirectory)
                                .AddJsonFile("appsettings.json")
                                .AddUserSecrets <TwilioSmsService>()
                                .AddEnvironmentVariables()
                                .Build();

            ISmsService smsService = new TwilioSmsService(configuration["Twillio:AccountSid"], configuration["Twillio:AuthToken"]);

            string to      = "+4367761289711";
            string message = "Hello World from Twilio SMS service.";


            smsService.SendSms(to, message);
        }