Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

400
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda