nextsms

package module
v0.0.0-...-947b831 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 5 Imported by: 0

README

Nextsms Golang Client

Golang Package to easy the integration with nextsms SMS Gateway

Getting started

  • Using this package would require an active nextsms account.

  • Add to your environment the username(NEXT_USERNAME) and password(NEXT_PASSWORD) in your environment.


export NEXT_USERNAME=<yournextsmsusername> 
export NEXT_PASSWORD=<yournextsmspassword>

Installing the package

To use this in your golang project, add it to the module.

go get github.com/Jkarage/nextsms
Send SMS

Here is an example on how to send an SMS with this package;

import (
    "github.com/Jkarage/nextsms"
    "io"
)

func main() {
    client := nextsms.New()
    resp, err := client.SendSDSMS("+255713507067", "Hello world", "")
    if err != nil {
        // handle the error
        log.Fatal(err)
    }

    // handle the response
}
Send SMS to Multiple Phone Numbers

Here is an example on how to send sms to multiple phone numbers, using nextsms client

import (
    "github.com/Jkarage/nextsms"
    "log"
)

func main() {
    client := nextsms.New()
    resp, err := client.SendMDSMS("Hi There", []string{"2557135070XX", "2557540534XX"}, "")
    if err != nil {
    log.Fatal(err)
    }
    if err != nil {
        // handle the error
        log.Fatal(err)
    }

    // handle the response
}

More Features in Progress. Tests on the way as well.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New() *Client

func (*Client) SendMDSMS

func (c *Client) SendMDSMS(message string, to []string, from string) (*http.Response, error)

sendMDSMS sends the same message to multiple phone numbers

func (*Client) SendSDSMS

func (c *Client) SendSDSMS(to, message, from string) (*http.Response, error)

SendSDSMS sends a single sms to a particular phone number provided for defaults senderid, put from ""

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL