Per the doc, one should be able to specify the PageSize parameter when doing a GET list of resources
https://www.twilio.com/docs/api/rest/response#response-formats-list-filters
How do you do this using NodeJS client? The only available parameters to be passed in to /Accounts/[AccountSid]/Messages/[MessageSid] are (from/to/dateSent)
You can specify the page size like this:
client.messages.each(
{
pageSize: 10
},
(message) => console.log(message.body)
);
This will make multiple requests to get all the messages, and for each request will return 10 records.
You can also add the limit
option to limit the total number of records returned, as well as the other filter parameters you mentioned.
const accountSid = 'ACc0966dd96e4d55d26ae72df4d6dc3494';
const authToken = "your_auth_token";
const client = require('twilio')(accountSid, authToken);
client.messages.each(
{
to: '+13335557777',
limit: 30,
pageSize: 10
},
(message) => console.log(message.body)
);
The default values are "no limit" (will get all) for limit
and 50 for pageSize
.