Skip to content

This project is a simple implementation of the VoIP.ms SMS API. It allows you to send SMS messages and host a web server for incoming SMS messages.

Notifications You must be signed in to change notification settings

ikifar2012/VoIP.ms-Node.js-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VoIP.ms SMS API

This project is a simple implementation of the VoIP.ms SMS API. It allows you to send SMS messages and host a web server for incoming SMS messages.

Please note that this implementation of the API is not complete and is intended for demonstration purposes only

For more information on the VoIP.ms SMS API, see the official documentation.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need to have Node.js and npm installed on your machine.

Installing

  1. Clone the repository
  2. Install the dependencies using npm:
npm install

Configuration

Create a env.js file in the root directory of the project, and insert your API credentials:

module.exports = {
    API_PASSWORD: 'your-api-password',
    API_USER: 'your-api-username',
    DID: 'your-did',
    API_KEY: 'your-api-key'
};
Variable Description
API_PASSWORD Set in the VoIP.ms control panel under Main Menu > SOAP / REST API > API Security.
API_USER The username/e-mail you use to log in to the VoIP.ms control panel.
DID The phone number you want to send SMS messages from.
API_KEY A random string of characters that you use to authenticate incoming SMS messages in the SMS Callback URL.

You can generate a random string of characters using the following command:

openssl rand -hex 32

Running the Server

Start the server by running:

node index.js

The server will start on port 3000.

Usage

To send an SMS, call the sendSMS function with the destination phone number and the message:

sendSMS('5555555555', 'Hello, world!');

To receive an SMS, VoIP.ms will send a GET request to https://example.com/sms with the following query parameters: to, from, message, files, id, date, and api_key.

Via the SMS Callback URL in the VoIP.ms control panel, you can set the URL to:

https://example.com/sms?to={TO}&from={FROM}&message={MESSAGE}&files={MEDIA}&id={ID}&date={TIMESTAMP}?api_key=your-api-key

VoIP.ms will replace the query parameters with the appropriate values.

Support

If you found this project helpful, please consider using my referral link to sign up for VoIP.ms. I will receive a small commission at no extra cost to you.

About

This project is a simple implementation of the VoIP.ms SMS API. It allows you to send SMS messages and host a web server for incoming SMS messages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published