troubleshooting Question

C# with SMS Texting

Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America asked on
C#* SMS* Twilio
2 Comments1 Solution42 ViewsLast Modified:
The following codes written in c# with Twilio is working okay.
But I want to read Twilio's status (e.g. sent, error)
and I try message.status and it does not working.
do you know how to check the message status?

I expect to something like below

if  (message.status == "sent")
{
UpdateSMSInfo(s);
}

 public static int SendSMSInBulk(Domain.SMS s)
        {
            string str = string.Empty;
            int count = 0;
            string phoneListStr = string.Empty;
            foreach (Domain.SMS smsInfo in MasterHelper.SMS.GetPhoneNoList(s))
            {
                str = str + "+1" + smsInfo.MobilePhoneNo + ",";
            }
            if (str != "")
            {
                phoneListStr = str.Remove(str.Length - 1);
                TwilioClient.Init(TwilioSID, TwilioToken);
                var numbersToMessage = new List<string>
                {
                //"+13105975782",               
                 phoneListStr
                };
               foreach (var number in numbersToMessage)
                    {
                        var message = MessageResource.Create
                        (
                            body: s.Message,
                            from: new Twilio.Types.PhoneNumber("+1" + TwilioPhoneNo),
                            to: new Twilio.Types.PhoneNumber(number) //member's mobile phone no
                        );
	                #region check if i can use status                    

                        s.MobilePhoneNo = number.Replace("+1", string.Empty);

                        UpdateSMSInfo(s);
                        count = count + 1;
                        #endregion
                } 
            }    
            return count;
        }
ASKER CERTIFIED SOLUTION
Eduard Ghergu
Architect - Coder - Mentor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros