Skip to content

NdoleStudio/httpsms-node

Repository files navigation

httpsms-node

Version Build codecov GitHub contributors GitHub license Downloads

This httpSMS library provides a server side javascript and typescript client for the httpSMS API.

Install

pnpm install httpsms-node
# or
npm install httpsms-node
# or
yarn install httpsms-node

Implemented

  • MessageService
    • POST /v1/messages/send: Send a new SMS
  • Cipher
    • Encrypt: Encrypt the content of a message to cipher text
    • Decrypt: Decrypt an encrypted message content to plain text

Usage

Initializing the Client

An instance of the client can be created using httpsms.New().

package main

import (
    "github.com/NdoleStudio/httpsms-go"
)

func main()  {
    client := htpsms.New(htpsms.WithDelay(200))
}

Error handling

All API calls return an error as the last return object. All successful calls will return a nil error.

_, response, err := client.MessageService.Send(context.Background())
if err != nil {
    //handle error
}

MessageService

POST /v1/messages/send: Send a new SMS Message

message, response, err := client.MessageService.Send(context.Background(), &MessageSendParams{
    Content: "This is a sample text message",
    From:    "+18005550199",
    To:      "+18005550100",
})

if err != nil {
    log.Fatal(err)
}

log.Println(message.Code) // 202

Testing

You can run the unit tests for this client from the root directory using the command below:

go test -v

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Node client for the httpSMS API https://httpsms.com

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy