twilio / twilio-node

Node.js helper library
MIT License
1.37k stars 495 forks source link

update you readme ffs. #990

Closed ralyodio closed 1 month ago

ralyodio commented 6 months ago

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

Spacey4K commented 5 months ago

Here's an example on how to import with esm modules.

import Twilio from "twilio";
const client = Twilio(accountSid, authToken);
celesteking commented 4 months ago

Twilio doesn't give a shit. It's no longer a dev first platform.

tiwarishubham635 commented 3 months ago

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!

tiwarishubham635 commented 1 month ago

Closing this issue as no update was received in last 30 days