npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@msgly/plivo-voice

v1.11.0

Published

Plivo Voice adapter for Msgly

Readme

@msgly/plivo-voice

📖 Docs & channel reference: https://ayushjain070401.github.io/msgly/

Plivo Voice adapter for Msgly — inbound IVR and outbound calls, using the same Auth ID and Token as @msgly/plivo.

npm install @msgly/core @msgly/plivo-voice
import { createHub } from '@msgly/core';
import { createPlivoVoiceAdapter, contentToPlivoXml } from '@msgly/plivo-voice';

const voice = createPlivoVoiceAdapter({
  authId: process.env.PLIVO_AUTH_ID!,
  authToken: process.env.PLIVO_AUTH_TOKEN!,
  phoneNumber: '+15551234567',
  webhookUrl: 'https://example.com/webhook/plivo-voice',

  // A phone call is request/response — this is where IVR logic lives.
  respond: (message) =>
    contentToPlivoXml(
      { type: 'text', text: `Thanks for calling. You pressed ${message.content.text}.` },
      { voice: 'WOMAN', language: 'en-US' },
    ),
});

const hub = createHub().register(voice);

respond is not optional for IVR

Plivo holds the HTTP request open and speaks whatever XML comes back, so the reply has to be produced during that request. The hub's on('message') handler runs after the response has already been sent — too late to say anything to the caller.

respond is deliberately synchronous. An await there is dead air on the line, and Plivo gives up on a slow webhook.

Return null to fall through to the hub's normal flow.

Buttons become keypad digits

A phone has no screen. interactive content maps to <GetDigits>, with each button becoming the digit at its position and the prompt reading them out:

{ type: 'interactive', text: 'How can we help?', buttons: [
  { id: 'sales', label: 'sales' },       // "Press 1 for sales."
  { id: 'support', label: 'support' },   // "Press 2 for support."
]}

The press arrives as an inbound message whose interaction.data is the digit.

Content

| Msgly content | Plivo XML | | --- | --- | | text | <Speak> with the configured voice and language | | audio (URL ref) | <Play> | | interactive | <GetDigits> with a spoken menu |

Text is XML-escaped, so an ampersand in a customer's name cannot break the document. An uploaded platform-id audio ref is refused — Plivo fetches the file itself, so an id means nothing to it.

Changing a live call

send() redirects a call already in progress, keyed on metadata.callUuid from the inbound message. Plivo redirects to a URL rather than accepting XML inline, so pass metadata.transferUrl too:

await hub.send({
  channel: 'plivo-voice',
  /* ... */
  content: { type: 'text', text: 'Putting you through now.' },
  metadata: { callUuid, transferUrl: 'https://example.com/ivr/transfer' },
});

For the common case — answering the call that is ringing right now — use respond and none of this applies.

initiateCall(), updateCall() and endCall() cover outbound dialling and call control.

Call outcomes

parseStatuses turns call-event callbacks into receipts:

| Plivo status | Receipt | permanent | | --- | --- | --- | | ringing, initiated | sent | — | | in-progress, answered | delivered | — | | completed | read | — | | failed | failed | ✅ | | busy, no-answer, timeout | failed | ❌ (retryable) |

Only a genuinely failed call suppresses. Busy and no-answer are the person, not the number — they may well answer next time, and suppressing there quietly deletes a live customer.

Webhook verification

Plivo's V3 signature covers the URL, so webhookUrl must match what Plivo calls byte for byte. Without it there is nothing to verify and the adapter rejects rather than accepting blindly:

createPlivoVoiceAdapter({ ...config, allowUnsignedWebhooks: true });  // only if something else authenticates

Several comma-separated signatures are accepted, which is what Plivo sends during key rotation.

License

MIT