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);
}
Select all Open in new window
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;
}
Select all Open in new window