Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/android-sms-gateway/client-ts
A JS/TS client library for sending and managing SMS messages via the SMS Gateway for Android™ API.
https://github.com/android-sms-gateway/client-ts
api-client javascript message-sending nodejs sms sms-api sms-client sms-gateway sms-integration
Last synced: 30 days ago
JSON representation
A JS/TS client library for sending and managing SMS messages via the SMS Gateway for Android™ API.
- Host: GitHub
- URL: https://github.com/android-sms-gateway/client-ts
- Owner: android-sms-gateway
- License: apache-2.0
- Created: 2023-12-09T16:38:18.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-29T08:35:48.000Z (about 1 month ago)
- Last Synced: 2024-11-29T09:32:28.035Z (about 1 month ago)
- Topics: api-client, javascript, message-sending, nodejs, sms, sms-api, sms-client, sms-gateway, sms-integration
- Language: TypeScript
- Homepage:
- Size: 133 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![npm](https://img.shields.io/npm/v/android-sms-gateway?style=for-the-badge)
![License](https://img.shields.io/badge/license-Apache--2.0-blue?style=for-the-badge)
![Downloads](https://img.shields.io/npm/dw/android-sms-gateway?style=for-the-badge)
![GitHub issues](https://img.shields.io/github/issues/android-sms-gateway/client-ts?style=for-the-badge)
![GitHub stars](https://img.shields.io/github/stars/android-sms-gateway/client-ts?style=for-the-badge)# SMS Gateway for Android™ JS/TS API Client
This is a JavaScript/TypeScript client library for interfacing with the [SMS Gateway for Android](https://sms-gate.app).
## Features
- Send SMS messages with a simple method call.
- Check the state of sent messages.
- Managing webhooks.
- Customizable base URL for use with local or cloud servers.## Prerequisites
Before you begin, ensure you have met the following requirements:
- You have a basic understanding of JavaScript and Node.js.
- You have Node.js and npm installed on your local machine.## Installation
To install the SMS Gateway for Android API Client, run this command in your terminal:
```bash
npm install android-sms-gateway
```## Usage
Here's how to get started with the SMS Gateway API Client:
1. Import the `Client` class from the library.
2. Create an instance of `Client` with your login credentials.
3. Use the `send` method to send an SMS message.
4. Use the `getState` method to check the status of a sent message.```javascript
import Client from "android-sms-gateway";// Example of an HTTP client based on fetch
const httpFetchClient = {
get: async (url, headers) => {
const response = await fetch(url, {
method: "GET",
headers
});return response.json();
},
post: async (url, body, headers) => {
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body)
});return response.json();
},
delete: async (url, headers) => {
const response = await fetch(url, {
method: "DELETE",
headers
});return response.json();
}
};// Initialize the client with your API credentials
const apiClient = new Client('your_login', 'your_password', httpFetchClient);// Example: Send an SMS message
const message = {
phoneNumbers: ['+1234567890', '+9876543210'],
message: 'Your SMS message text here'
};apiClient.send(message)
.then(messageState => console.log(messageState))
.catch(error => console.error(error));// Example: Get the state of an SMS message
const messageId = 'your_message_id';apiClient.getState(messageId)
.then(messageState => console.log(messageState))
.catch(error => console.error(error));
```## API Reference
For more information on the API endpoints and data structures, please consult the [SMS Gateway for Android API documentation](https://docs.sms-gate.app/integration/api/).
# Contributing
Contributions are welcome! Please submit a pull request or create an issue for anything you'd like to add or change.
# License
This library is open-sourced software licensed under the [Apache-2.0 license](LICENSE).