Closed ralyodio closed 1 month ago
Here's an example on how to import with esm modules.
import Twilio from "twilio";
const client = Twilio(accountSid, authToken);
Twilio doesn't give a shit. It's no longer a dev first platform.
Hi folks! Here is an example to use twilio with es module.
import twilio from 'twilio'
const accountSid = 'xxx'
const authToken = 'xxx'
const client = twilio(accountSid, authToken)
client.messages
.create({
body: 'Hello from Twilio',
from: '+1xxx',
to: '+1xxx'
})
.then(message => {
console.log(message.sid)
})
Make sure you have "type": "module"
present in your package.json. Thanks!
Closing this issue as no update was received in last 30 days
Preflight Checklist
Problem Description
give me an example with esm 2022 modules
Proposed Solution
give me an example with esm 2022 modules
Alternatives Considered
give me an example with esm 2022 modules
Additional Information
give me an example with esm 2022 modules