Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@parloa/twilio-helper-package

Package Overview
Dependencies
Maintainers
37
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parloa/twilio-helper-package

Library to generate calls via twilio API

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
increased by53.85%
Maintainers
37
Weekly downloads
 
Created
Source

Overview

This package is a Node.js library designed to facilitate the generation of calls using the Twilio API. It provides functions for creating and managing Twilio calls, allowing developers to easily integrate Twilio functionality into their applications.

Requirements

An npm account in the Parloa org. Make sure you are logged in with npm login.

Installation

To install the package, use the following command:

npm install @parloa/twilio-helper-package

Usage

  1. Importing the Package

const twilioHelper = require('@parloa/twilio-helper-package');

  1. Making a Twilio Call
const options = {
  accountSid: 'your_account_sid',
  authToken: 'your_auth_token',
  fromNumber: 'your_twilio_phone_number',
  toNumber: 'destination_phone_number',
  textToPlay: 'text_to_say_or_mp3_url',
  seconds: 5, // duration of pauses in seconds
  twiMLType: 'sayAndPause', // or 'mp3'
};

twilioHelper.makeTwilioCall(options)
  .then(callSid => {
    console.log(`Twilio call initiated with Call SID: ${callSid}`);
  })
  .catch(error => {
    console.error(`Error: ${error.message}`);
  });
  1. Adding Parts to an Existing Twilio Call
const { accountSid, authToken, callSid } = options; // reuse options or provide necessary values
const ssml = '<speak>additional_text_to_say</speak>';

twilioHelper.addPartToTwilioCall(accountSid, authToken, callSid, ssml, 3)
  .then(updatedCallSid => {
    console.log(`Twilio call updated with additional part. Updated Call SID: ${updatedCallSid}`);
  })
  .catch(error => {
    console.error(`Error: ${error.message}`);
  });
  1. Waiting for a Call to Complete
twilioHelper.waitForCallToComplete(accountSid, authToken, callSid)
  .then(completedCall => {
    console.log(`Twilio call completed. Final Call Status: ${completedCall.status}`);
  })
  .catch(error => {
    console.error(`Error: ${error.message}`);
  });

Publishing new version

  1. Make the required changers and merge to main branch (Make sure to increase the version in package.json)
  2. Login to npm registry
  3. Run npm publish
  4. Go to package page to check that the package version has been updated

FAQs

Package last updated on 08 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc