piopiy

0.8.1 • Public • Published

PIOPIY NodeJS SDK

The Node.js SDK is used to integrate communications into your Node.js applications using the PIOPIY REST API. Using the SDK, you will be able to make voice calls and can control your call flows.

Install

Follow the below installation instructions

Prerequisites

Prerequisites for javascript web server.

  • node.js (>= v10.16.3 required)
  • npm (>= 6.9.0 required)

Installation

Install the SDK using npm

$ npm install piopiy

Authentication

In order to authenticate your app, and to make an API request, you should have an app id and secret for authentication. Find your App ID and secret in your PIOPIY dashboard

Specifiy the authentication credentials

const Piopiy = require( 'piopiy' );
const piopiy = new Piopiy( 'your_app_id', 'your_app_secret' );

Make a call

To make a call , mention the to_number, piopiy_phone_number and .

piopiy.voice.call( 
    'your_leg_a_to_number', 
    'your_piopiy_phone_number',
    'your_leg_b_to_number' 
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

To make a call using PCMO, mention the to_number, piopiy_phone_number and .

piopiy.voice.callPCMO( 
    'your_to_number', 
    'your_piopiy_phone_number',
    'your_PCMO_Object' 
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

To make a call with answer, mention the to_number, piopiy_phone_number and answer_url.

piopiy.voice.make( 
    'your_to_number', 
    'your_piopiy_phone_number',
    'your_answer_url' 
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

Hold a call

To hold a call, mention the cmiuuid of the call.

piopiy.voice.hold( 
    'cmiuuid'
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

Unhold a call

To unhold a call, mention the cmiuuid of the call.

piopiy.voice.unhold( 
    'cmiuuid'
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

Toggle a call

To toggle a call, mention the cmiuuid of the call.

piopiy.voice.toggle( 
    'cmiuuid'
).then( ( result  ) => {
     console.log( result  )
} ).catch( ( error ) => {
     console.log( error )
} );

Hangup a call

To hangup a call, mention the cmiuuid of the call.

piopiy.voice.hangup( 
    'cmiuuid'
).then( ( result  ) => {
     console.log( result )
} ).catch( ( error ) => {
     console.log( error )
} );

More Examples

Refer to the piopiy docs for more examples. Now create the PIOPIY account and setup the express server and test out your integration in few minutes.

Reporting issues

For any feedbacks and problems, you can open an issue on github.

Package Sidebar

Install

npm i piopiy

Weekly Downloads

0

Version

0.8.1

License

MIT

Unpacked Size

52.2 kB

Total Files

31

Last publish

Collaborators

  • telecmi