Socket
Socket
Sign inDemoInstall

android-sms-gateway

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    android-sms-gateway

A JS/TS client library for sending and managing SMS messages via the Android SMS Gateway API


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Android SMS Gateway JS/TS API Client

This is a JavaScript/TypeScript client library for interfacing with the Android SMS Gateway API.

Features

  • Send SMS messages with a simple method call.
  • Check the state of sent messages.
  • 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 API Client, run this command in your terminal:

npm install sms-gateway-client

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.
const { Client } = require('sms-gateway-client');

// 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();
    }
};

// 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 Android SMS Gateway API documentation.

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.

Keywords

FAQs

Last updated on 11 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc