This is a Go SDK for the Labsmobile SMS Gateway API.
go get github.com/fsandov/labsmobile-sdk-go
All the documentation of the API can be found here.
- Create a new client with your credentials. You can find your credentials in the API Credentials section of your Labsmobile account. Its recommended to use environment variables to store your keys.
- Create a context, you can use the
context.Background()
function. Also you can use thecontext.WithTimeout()
function to set a timeout for the request. - Create a struct with data to send to the API.
Example:
import "github.com/fsandov/labsmobile-sdk-go/pkg/sms"
func main() {
// Create a context
ctx := context.Background()
// Create a client
client := sms.NewClient("your-username", "your-password")
message := sms.Message{
Destination: "34600000000",
Message: "Hello World",
}
response, err := client.Send(ctx, message)
if err != nil {
panic(err)
}
fmt.Println(response)
}
You can see more examples in the examples folder of this repository.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.