Skip to content
Go based SMSC API interface
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
dialing_number.go
dialing_number_test.go
message.go
message_test.go
smsc.go
smsc_api.go
smsc_api_test.go
smsc_test.go

README.md

GoSMSC

Intent

This library provides simple communcation with SMSC

Usage

1 Create a credential with your alias and api key

    c := new(api.Credential)
    c.Alias = "MyAlias"
    c.APIKey = "14928_19675488er559c4d0ba1424ff0fcd562"

2 Create an instance of SMSC passing the credential as param

    s := api.NewSMSC(c)

3 Create a message to be sent with the content, and a dialing number

    m, err := api.NewMessage("Greetings from a gopher friend")
    if err != nil{
        fmt.Prinln(err)
    }	
    n, err := api.NewDialingNumber("011", "153256689")
    if err != nil {
        fmt.Println(err)
    }

4- Send the message

	resp, _ := s.Send(m, n)
	fmt.Println(resp)

Full example

import (
	"fmt"

	smsc "github.com/nicoCalvo/gosmsc"
)

func main() {
	c, err := smsc.NewCredential("MyAlias", "14928_19675535410b24ff0fcd562")
	if err != nil {
		fmt.Println(err)
	}
	s := smsc.NewSMSC(c)

	n, err := smsc.NewDialingNumber("011", "153256689")
	m, err := smsc.NewMessage("Greetings from a gopher friend")
	resp, err := s.Send(m, n)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(resp)
}

Other methods availables:

Check balance

 s := api.NewSMSC(c)
 b, err := s.Balance()

Get sent messages

 s := api.NewSMSC(c)
 b, err := s.Sent()

Get sent messages starting from a given id

 s := api.NewSMSC(c)
 b, err := s.s.SentSince("17164713")

Get received messages:

 s := api.NewSMSC(c)
 b, err := s.s.Received()

Get received messages starting from a given id

 s := api.NewSMSC(c)
 b, err := s.s.ReceivedSince("17164713")

Cancel queue

 s := api.NewSMSC(c)
 b, err := s.CancelQueue()

Check status

 s := api.NewSMSC(c)
 b, err := s.Status()
You can’t perform that action at this time.