Hi @joncipriano, I executed your script with my credentials but I get the following error message:
{"errors":[{"code":87,"message":"Client is not permitted to perform this action."}]}
In my “Application Management console > Application Settings > Your Access Token” I can see:
Access Level Read, write, and direct messages
So in theory I have permissions to manage direct messages, but somehow Twitter API won’t let me… is this an issue on your side?