示例#1
0
        private MagnetMessage CreateMessage(TwilioSmsRequest twilioSmsRequest)
        {
            var properties = new Dictionary <string, string>();

            properties.Add("Twilio-Message-ID", twilioSmsRequest.SmsSid);

            return(new MagnetMessage
            {
                Type = "Sms",
                Provider = "Twilio",
                ReceivedAt = DateTime.UtcNow,
                From = twilioSmsRequest.From,
                To = new List <string> {
                    twilioSmsRequest.To
                },
                Body = twilioSmsRequest.Body,
                Properties = properties,
            });
        }
示例#2
0
        public async Task <IActionResult> Sms(TwilioSmsRequest smsRequest)
        {
            await _messageSink.ProcessMessageAsync(CreateMessage(smsRequest));

            return(Ok());
        }