Sign up!
Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.
Send from API and manage your account with our online application WebSMS.
Below you will find the examples of programming code in the language Go to send SMS messages through the API of the LabsMobile platform.
You also have code examples in JavaScript, PHP and other programming languages.
We recommend you to consult and take into account the following resources and help in your integration:
This is the sample code in Go to send SMS messages with the LabsMobile SMS API in the JSON version. As you can see, you must create a JSON structure with all the sending parameters and make an HTTP/POST call with the JSON data in the body of the call.
It is essential to make the call with the authentication of the username (registration email) and the password (or token API) of the account.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.labsmobile.com/json/send" payload := strings.NewReader("{\"message\":\"Text of the SMS message\", \"tpoa\":\"Sender\",\"recipient\":[{\"msisdn\":\"12015550123\"},{\"msisdn\":\"447400123456\"},{\"msisdn\":\"5212221234567\"}]}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Basic " + basicAuth("myusername","mypassword")) req.Header.Add("Cache-Control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
You can check all available JSON parameters, configuration options, manuals and specifications in the following url: https://apidocs.labsmobile.com/?go#send-sms
Example of code in Go for consulting the balance of an account. The result is always obtained in internal credits of the LabsMobile platform.
package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.labsmobile.com/json/balance" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Basic " + basicAuth("myusername","mypassword")) req.Header.Add("Cache-Control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
Example of sending for the GET version of the LabsMobile SMS API. This is a basic and simple method of sending SMS messages from an application or software created in Go passing all the parameters in the same url.
It is important to encode all the values as url (with the function urlencode() for example).
You can see and download the GET API manual of LabsMobile in the following URL: https://www.labsmobile.com/en/api-sms/api-versions/http-get
import "net/http" resp, err := http.Get("http://api.labsmobile.com/get/send.php?username=[X]&password=[X]&msisdn=34609036253&sender=SENDER&message=This+is+the+message") if err != nil { // handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body)
import "net/http" resp, err := http.Get("http://api.labsmobile.com/get/balance.php?username=[X]&password=[X]") if err != nil { // handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body)
Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.
Send from API and manage your account with our online application WebSMS.
Sending confirmations, evaluations and reminders for medical appointments via SMS.
At LabsMobile we only offer direct routes of maximum reliability and quality. Enjoy our platform and all our services for the price of an SMS.
Pay ONLY for sent messages.
Our technical department has professionals with years of experience and we have made multiple integrations.
We guide and help you through the process.
This tutorial will explain how to send your first SMS messages from a new account using the basic and manual sending form.