Attempting to integrate Twilio into my Ionic 3 application has been a bit of a challenge. While it works fine when tested on a browser, running it on an actual device led to a frustrating error message:
TypeError: undefined is not a function {stack: (...), message: "undefined is not a function"}
My approach in index.html involved importing Twilio via a CDN:
<script type="text/javascript" src="https://media.twiliocdn.com/sdk/js/client/releases/1.6.5/twilio.js"></script>
Then, in my component, I declared the Twilio variable:
declare var Twilio: any;
Subsequently, I attempted to use it as follows:
const device = Twilio.Device(token);