예제 #1
0
파일: SmsController.cs 프로젝트: adkl/nsi
        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
            }));
        }
예제 #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);
        }