voipnumber

1.0.5 • Public • Published

Install

npm i voipnumber

Send SMS

Send SMS from your Number to any other number:

const voipnumber = require('voipnumber')('accountId','apiToken');

const from = '+447893456836';
const to = '+447484864727';

voipnumber.sms.send(from, to, 'text to send in SMS').then((res) => {
    console.log(res);
}).catch((err) => {
    console.log(err);
});

First number (from) must belong to your account and must have SMS capabilities. You will find your accountId and apiToken on the Settings page at app.voipnumber.net

Receive SMS

  1. Go to the Numbers page on your VoIP Number account at app.voipnumber.net
  2. Find the Number you want to use for receiving SMS and setup SMS Webhook to your url
  3. Send SMS to your Number and receive https post request with SMS content at your url

Make sure the webhook url you will set can receive a call from public network. Our message is sent to your webhook from api.voipnumber.net in JSON format and contains Host: 'api.voipnumber.net' header that you can use for authorization check

headers: {
   'Content-Type': 'application/json',
   Host: 'api.voipnumber.net',
   'X-Forwarded-Port': '443',
   'X-Forwarded-Proto': 'https'
}

Our message to your webhook contains following data

{
   status: 'received',
   from: '+447893456836',
   to: '+447484864727',
   type: 'sms' | 'mms',
   body: 'text received in SMS',
   mdr_timestamp_s: 1716204585,
   mdr_created: '20 May 2024 11:29:45',
   mdr_id: 'da84a7b1-1a80-4e96-885e-e719d5ec909c'
}

where mdr_timestamp_s, mdr_created and mdr_id refer to the Messaging Data Record created on receipt of this SMS/MMS message. Every SMS/MMS message is reported on the Messaging Data Records page at app.voipnumber.net/messaging You will also see there if your webhook was called and what was the (HTTPs) status code returned by your infrastructure through that call

Package Sidebar

Install

npm i voipnumber

Weekly Downloads

61

Version

1.0.5

License

ISC

Unpacked Size

5.42 kB

Total Files

4

Last publish

Collaborators

  • piotrgregor