예제 #1
0
        private async Task HandleAsync(NotificationEvent @event)
        {
            try
            {
                if (@event.NotificationType == 1)
                {
                    // Send email
                    await _emailSender.SendEmailAsync(@event.NotificationRecipient, @event.NotificationSubject, @event.NotificationBody);
                }

                if (@event.NotificationType == 2)
                {
                    // Send sms text
                    string from = "+16042434804";

                    await _smsSender.SendTextAsync(@event.NotificationRecipient, from, @event.NotificationBody);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


            //throw new NotImplementedException();
        }
예제 #2
0
        public async Task <IActionResult> SendSmsText(/*MessageModel model*/)
        {
            //var message = MessageResource.Create(
            //    to: new PhoneNumber(model.To),
            //    from: new PhoneNumber(model.From),
            //    body: model.Message,
            //    client: _client); // pass in the custom client

            //return Ok(message.Sid);

            string from    = "+16042434804";
            string to      = "16043497898";
            string content = "Test sms....with config data";

            var result = _smsSender.SendTextAsync(to, from, content);

            return(Ok(result));
        }