Forum Discussion
datadude
9 years agoRegular Visitor
Twilio Content Pack 50 message limit (pagination)
The Twilio API limits the number of returned items to 50 by default, up to a maximum of 1000 per call. There is the usual embedded next page URI so you can request more data, but I've found no guidan...
Anonymous
7 years agoNot applicable
You can use the twilio API in a python script to get the full data.
If you want this to be available on Power BI Service, however, I believe you will need to run the query through a personal gateway as well as hard code the Twilio credentials (which is, generally, not a good idea) into your script as is discussed in regards to the Zendesk API here.
You will also need to install the Twilio API Python SDK
You could also try to construct the API request in an R script, but using the Python SDK is much easier. This works for me:
from twilio.rest import Client
import pandas as pd
account_sid = 'YOUR_ACCOUNT_SID_HERE'
auth_token = 'YOUR_AUTH_TOKEN_HERE'
client = Client(account_sid, auth_token)
messages = client.messages.list(limit=51)
frame = pd.DataFrame(columns=['sid','date_sent','account_sid','to','from','body','status',
'num_segments','num_media','direction','price','error_code','error_message','date_created','date_updated'])
for record in messages:
frame = frame.append({'sid':record.sid,'date_sent':record.date_sent,'account_sid':record.account_sid,
'to':record.to,'from':record.from_,'body':record.body,'status':record.status,'num_segments':record.num_segments,
'num_media':record.num_media,'direction':record.direction,'price':record.price,'error_code':record.error_code,
'error_message':record.error_message,'date_created':record.date_created,'date_updated':record.date_updated},ignore_index=True)