Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

401
Views
Get twilio usage data using an AWS Lambda (nodejs)

I would like to be able to get usage data from Twilio from within an AWS Lambda function. I am following the examples on twilio's REST API page but am not having any success. I am using version 3 of Twilio's Node Helper Library. Below is the code that I have in the handler:

    'use strict';
    exports.handler = async(request, context) => {
        const accountSid = 'my account sid'; 
        const authToken = 'my auth token'; 
        const client = require('twilio')(accountSid, authToken);
        client.usage.records.today.each(record => console.log(record.count));
    };

The Lambda "feels" like it is at least trying to get the data from Twilio. It runs for ~10 seconds before ending without any errors. However I never get the 'here' message.

Thanks in advance, Scott

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is my Lambda code:

 exports.handler = (event, context, callback) => { // Your Account SID from www.twilio.com/console const accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Auth Token from www.twilio.com/console const authToken = process.env.TWILIO_AUTH_TOKEN; // Import Twilio's Node Helper library // Create an authenticated Twilio Client instance const client = require('twilio')(accountSid, authToken); client.usage.records.lastMonth.each(record => console.log('here')); };

and this is what I see in the "Function Code" section after running the function (Status: Succeeded).

enter image description here

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!