Reputation: 1432
I am working in nodejs and this is my existing code, which is fetching all the twilio calls:
client = require("twilio")(accountSid, authToken);
client.calls.list({ });
I want to get twilio calls which were made between a start and end start. Something like this:
client.calls.list({ dateCreated: { $gt: start, $lt: end } });
How can I achieve this?
Upvotes: 0
Views: 605
Reputation: 10771
There is some starter code examples here:
Call Resource https://www.twilio.com/docs/voice/api/call-resource
Node Example: "Read multiple Call resources and filter by 'after start' date"
Month starts at 0 (0 = January)
client.calls
.list({
startTimeAfter: new Date(Date.UTC(2020, 4, 15, 0, 0, 0)),
endTimeBefore: new Date(Date.UTC(2020, 5, 18, 0, 0, 0)),
status: 'completed',
limit: 200
})
.then(calls => calls.forEach(c => console.log(c.dateCreated)))
.catch(err => console.log(err));
Upvotes: 1