Example code for SMS integration in language Go

Send SMS - REST API - JSON

            
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))

}

Credit inquiry - REST API - JSON

            
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))

}

Send SMS - 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)

Credit inquiry - HTTP/GET


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)
  • contact form support

    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.

    Create new account
  • Artichoke Dolls, Artisanal eCommerce recommends LabsMobile

    Communication with eCommerce clients: change in status and delivery of orders with parcel tracking.

    Watch more reviews
  • dashboard aplicación online

    Maximum reliability at the best price

    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.

    Check our rates
  • dashboard aplicación online

    Need more info? Contact us!

    Our technical department has professionals with years of experience and we have made multiple integrations.

    We guide and help you through the process.

    Request technical support
  • Results of your sendings or SMS campaigns

    This tutorial explains how to obtain statistics results or reports of SMS sendings made from a WebSMS account.

    Ir al tutorial
loader