vadam
vadam

Reputation: 11

How to filter twilio messages after a certain time

I want to process only Twilio SMS messages that are received after my service has started. I am not able to get the code working in python. Please help.

I wonder if even this snippet is correct as well. It was copied from else where into my code.

Here is my python code. I am new to python.

messages = TwilioClient.messages.list(date_sent=datetime.datetime.utcnow())

for p in messages:
  sSMSSender = p.from_

if p.date_updated < date_sent:
  continue

Thank you in advance for your help.

Upvotes: 1

Views: 540

Answers (1)

Megan Speir
Megan Speir

Reputation: 3811

Megan from Twilio here.

The DateSent parameter is returned in RFC 2822 format. https://www.twilio.com/docs/api/rest/message#instance

Mon, 11 April 2016 15:52:01 +0000

Thus you will have to do a little extra work to separate time out this data. You can give it a try in a spreadsheet.

Hope this helps.

Upvotes: 1

Related Questions