using System; using TNZAPI.Messaging.Objects; using TNZAPI.Messaging.Get; namespace TNZGetSMSReceived { class Program { static void Main(string[] args) { const string sender = "application@domain.com"; const string api_key = "ta8wr7ymd"; const string time_period = 1440; // Return results from the last x minutes InboundSMSRequest sms_received = new InboundSMSRequest(sender, api_key); InboundSMSResult sms_received_result = sms_received.Poll(time_period); if (sms_received_result.Result == InboundSMSResult.ResultCode.Success) { Console.WriteLine("Inbound SMS Messages for the Time Period '" + time_period.ToString() + "':"); foreach (InboundSMSMessage received in sms_received_result.ReceivedMessages) { Console.WriteLine("======================================"); Console.WriteLine(" => MessageReceived"); Console.WriteLine(" -> Date: '" + received.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'"); Console.WriteLine(" -> From: '" + received.From + "'"); Console.WriteLine(" -> MessageText: '" + received.MessageText.Replace("'","\'") + "'"); } } else { Console.WriteLine("Could not find any inbound sms messages for the time period '" + time_period.ToString() + "' : '" + sms_received_result.ErrorMessage + "'"); } } } }