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

@streetjs/plugin-africastalking

v1.0.1

Published

Official Street Framework plugin: Africa's Talking (SMS, Bulk SMS, Voice, USSD, Airtime, Mobile Money). Signed manifest, PluginModule SDK, zero third-party deps.

Readme

@streetjs/plugin-africastalking

Official StreetJS plugin for Africa's Talking: SMS, Bulk SMS, Voice, USSD, Airtime, and Mobile Money — sandbox and production.

  • Zero third-party runtime dependencies (Node native fetch; streetjs is the framework).
  • TypeScript strict mode, ESM, signed Ed25519 manifest, official certification structure.
  • Pure, offline-testable request builders + a secret-safe executor (timeout + bounded retry).

Installation

npm install @streetjs/plugin-africastalking

Setup

import { createAfricaTalkingPlugin } from '@streetjs/plugin-africastalking';

const at = createAfricaTalkingPlugin({
  apiKey: process.env.AT_API_KEY!,
  username: process.env.AT_USERNAME!,
  sandbox: true,        // false (or omit) for production
  // timeoutMs: 15000,  // optional
  // retries: 2,        // optional (transient 429/5xx/network)
});

Sandbox

Use username: 'sandbox' and sandbox: true. Requests target the *.sandbox.africastalking.com hosts; interactions appear in the AT simulator.

Production

Use your real username and omit sandbox (or set false). Keep AT_API_KEY in an environment variable / secret store — it is sent as a header and is never logged or included in any error thrown by this plugin.

SMS

await at.sms.send({ to: '+254700000000', message: 'Welcome to StreetJS' });

await at.sms.sendBulk({
  recipients: ['+254700000000', '+254711111111'],
  message: 'Promotion!',
});

USSD

USSD is callback-driven: Africa's Talking POSTs { sessionId, serviceCode, phoneNumber, text } to your endpoint and you reply with CON … (more input) or END … (terminate). Build a router and return its output:

const ussd = at.createUssdRouter()
  .menu('Welcome\n1. Balance\n2. Buy airtime')          // shown on first hit
  .input('1', () => 'END Your balance is KES 500')
  .input('2', (req, segs) =>
    segs.length === 1 ? 'CON Enter amount:' : `END Buying KES ${segs[1]}`)
  .end('Invalid choice.');

// In a StreetJS controller:
@Post('/ussd')
async handleUssd(ctx: StreetContext): Promise<void> {
  ctx.text(ussd.handle(ctx.body as Record<string, unknown>));
}

Voice

await at.voice.call({ from: '+254700000000', to: '+254711111111' });

// In your voice callback route, validate + parse the event:
const event = at.voice.validateCallback(ctx.body, {
  expectedSecret: process.env.AT_CB_SECRET, providedSecret: ctx.query['s'],
});

Airtime

await at.airtime.send({
  phoneNumber: '+254700000000',
  amount: 100,
  currencyCode: 'KES',
});

Mobile Money

// C2B checkout (collect from a customer)
await at.mobileMoney.checkout({
  productName: 'MyStore', phoneNumber: '+254700000000', currencyCode: 'KES', amount: 500,
});

// B2C payout
await at.mobileMoney.b2c('MyStore', [
  { phoneNumber: '+254700000000', currencyCode: 'KES', amount: 100, reason: 'BusinessPayment' },
]);

// Transaction status
await at.mobileMoney.transactionStatus({ transactionId: 'ATXid_...' });

// Verify a payment callback (shared-secret pattern; callbacks are unsigned)
const payload = at.mobileMoney.verifyCallback(ctx.body, {
  expectedSecret: process.env.AT_CB_SECRET, providedSecret: ctx.query['s'],
});

Security recommendations

  • Never log the API key. This plugin treats it as a header and excludes it from all thrown errors; keep your own logging secret-safe too.
  • Serve callbacks (USSD/Voice/Payments) over HTTPS and gate them with a shared secret in the URL/path — Africa's Talking callbacks are not signed.
  • Validate amounts and recipients server-side before initiating airtime or mobile-money operations.
  • Use the built-in timeout + bounded retry; do not retry non-transient 4xx.
  • Run in sandbox until your flows are verified, then switch sandbox: false.

Manifest & signing

This package ships a manifest.json and an Ed25519-signed manifest.signed.json (verifiable against manifest.pub). Signing runs only at publish (prepublishOnlysign) and requires STREET_PLUGIN_SIGNING_KEY; a plain npm run build never signs. See the StreetJS Plugin Author Guide.

License

MIT