ITsolutionWizard
asked on
c# twilio API - SMS Conversation
Below codes is to call Twilio API and get the sms historical conversation for one phone no. However, it takes over 15 seconds and the total records is actually just 5 conversation.
Have any experts worked with Twilio in the past and know another way to get SMS conversation in a faster mode?
Thanks,
Have any experts worked with Twilio in the past and know another way to get SMS conversation in a faster mode?
Thanks,
TwilioClient.Init(accountSid, authToken);
var messages2 = MessageResource.Read().Where(x => x.From.ToString() == fromPhoneNo);
var messages3 = MessageResource.Read().Where(y => y.To == fromPhoneNo);
var all = messages2.Concat(messages3).OrderByDescending(z => z.DateCreated);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have the SID? Try Fetching the messages instead.
var message = MessageResource.Fetch("MM800f449d0399ed014aae2bcc0cc2f2ec");
I would think that using an SID to fetch a message would be much faster. Have a look at the Retrieve a Single Message section of the Twilio support documentation. If you're only fetching 5 messages here, this might just be faster.
ASKER
Thanks but I look for messages that came from one phone no
ASKER