twilio.js 758 B

123456789101112131415161718192021222324
  1. // import twilio from 'twilio'
  2. // const accountSid = 'ACf0d397ceb325114e435237056465b495'
  3. // const authToken = 'c23f40f96b936e837bc6da105bf9150e'
  4. // const client = twilio(accountSid, authToken)
  5. // client.messages
  6. // .create({
  7. // body: 'Hello from Twilio',
  8. // from: '+18559534242',
  9. // to: '+18583199738'
  10. // })
  11. // .then((message) => console.log(message.sid))
  12. import axios from 'axios'
  13. axios
  14. .get('https://lookups.twilio.com/v1/PhoneNumbers/14084220298?CountryCode=US&Type=carrier', {
  15. headers: {
  16. Authorization:
  17. 'Basic ' + btoa('ACf0d397ceb325114e435237056465b495' + ':' + 'c23f40f96b936e837bc6da105bf9150e')
  18. }
  19. })
  20. .then((res) => {
  21. console.log(res.data)
  22. })