How to use Twilio npm package in edge functions Deno
I've been trying to use the twilio package in Deno for edge functions but having no luck, does anyone know how I'm able to get it to work? very limited knowledge on this online.
https://www.npmjs.com/package/twilio
npm
twilio
A Twilio helper library. Latest version: 3.82.1, last published: 19 hours ago. Start using twilio in your project by running
npm i twilio
. There are 1091 other projects in the npm registry using twilio.2 Replies
How are you importing it in your function or where are you getting stuck? For starters you'll want to import the package a little differently than you would in a normal js file in your app - https://github.com/ije/esm.sh
GitHub
GitHub - ije/esm.sh: A fast, global content delivery network for ES...
A fast, global content delivery network for ES Modules. - GitHub - ije/esm.sh: A fast, global content delivery network for ES Modules.
Yes, I was aware of that Drew thanks,
I tried various things with the import but no luck, It wasn't helping that all my logging wasn't working either. I am currently just doing it via a post request as outlined in this related blog post: https://www.twilio.com/blog/sending-sms-messages-deno-typescript-twilio-messaging
Twilio Blog
Sending SMS Messages with Deno, TypeScript, and Twilio Messaging
Learn how to send SMS messages from a TypeScript application running on Deno with this complete tutorial. You'll also see how to create a wrapper class for Twilio APIs. Deno is a modern platform for server-side JavaScript and TypeScript, including a package system without the bloat of node_modules.