8000 GitHub - PreCogSecurity/ussd-router: A free utility for easy routing in USSD applications
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PreCogSecurity/ussd-router

 
 

Repository files navigation

ussd-router

ussd-router is a free utility for easy routing in USSD applications.

See also:

Install

npm i ussd-router

Example usage (simple)

import { ussdRouter } from 'ussd-router';

const text1 = ussdRouter('544*1*2'); // '544*1*2'
const text2 = ussdRouter('544*1*2*00*3'); // '544*1*3'
const text3 = ussdRouter('544*1*2*0*1*2'); // '1*2'
const text4 = ussdRouter('544*1*2*0*1*2*00*3'); // '1*3'

Example usage (with express)

import express from 'express';
import { ussdRouter } from 'ussd-router';

// ...

app.post('/webhook/ussd', (req, res) => {
  const { body: { text: rawText } } = req;

  const text = ussdRouter(rawText);

  if (text === '1') {
    res
      .status(200)
      .send('View: \n1. My account number \n2. My balance');
  }

  // ...
});

Dev

# install dependencies
npm i

# build
npm run build

# lint
npm run lint

# test
npm t

About

A free utility for easy routing in USSD applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 85.3%
  • JavaScript 14.7%
0