https://github.com/dashawk/goip-node
This is a simple package that can send sms through a goip gateway
https://github.com/dashawk/goip-node
Last synced: 24 days ago
JSON representation
This is a simple package that can send sms through a goip gateway
- Host: GitHub
- URL: https://github.com/dashawk/goip-node
- Owner: dashawk
- License: mit
- Created: 2023-02-03T17:09:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T06:31:06.000Z (over 3 years ago)
- Last Synced: 2025-10-29T23:57:29.147Z (9 months ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goip-node
This is a simple package that can send sms through a goip gateway. This library is for sending SMS messages from a web application. It uses the [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser) library to parse XML responses from the server and provides an easy way to send and check the status of messages.
## Installation
To install goip-node, simply run:
```
npm install goip-node
```
## Usage
Using goip is simple. First, create an instance of the class:
```javascript
const GoIP = require('goip-node')
const url = `http://IP-ADDRESS`
const options = {
line: 1,
user: 'user',
pass: 'pass'
}
const sms = new GoIP(url, options)
```
The `url` parameter is the URL of your server and `options` is an object containing your authentication credentials (line, user, and pass). You can also pass additional options such as
`sendUrl`,
`statusUrl`,
`statusRetries`,
`statusWait`, and `timeout`.
To send a message, use the `send()` method:
```javascript
const response = sms.send(phoneNumber, message)
```
This will return an object with the message ID and raw response from the server. If you have enabled status waiting in your options, it will also check the status of the message until it has been sent or until it reaches its maximum number of retries (default 5).
To check the status of a message manually, use the `sent()` method:
```javascript
// returns true if sent successfully or false if not sent yet
sms.sent(response.id)
```