SMS Go API example


package main

import (
  "encoding/json"
  "net/http"
  "log"
  "bytes"
)

func main() {

  token := "your.token"; //Your first token must be generated on our plateform at https://my.smsfactor.com/developers/api-tokens

  payload := map[string]interface{}{
    "sms": map[string]interface{}{
      "message": map[string]interface{}{
        "text": "Hello, it's me. I was wondering if after all these years you'd like to meet",
        "pushtype": "marketing",
        "sender": "ADELE",
      },
      "recipients": map[string]interface{}{
        "gsm": []interface{}{
          map[string]interface{}{
            "gsmsmsid": "100",
            "value": "33612345678",
          },
          map[string]interface{}{
            "gsmsmsid": "100",
            "value": "33612345678",
          },
        },
      },
    },
  }

  jsonPayload, err := json.Marshal(payload)
  if err != nil {
    log.Fatalln(err)
  }

  req, err := http.NewRequest("POST", "https://api.smsfactor.com", bytes.NewBuffer(jsonPayload))
  req.Header.Add("Authorization", "Bearer " + token)
  req.Header.Add("Accept", "application/json")
  client := &http.Client{}
  res, err := client.Do(req)
  if err != nil {
    log.Fatalln(err)
  }

  var result map[string]interface{}

  json.NewDecoder(res.Body).Decode(&result)

  log.Println(result)
}
  	
	

When to take advantage of an SMS API with Go?

Enhance the reach of your communications by integrating our SMS Go API. Adding SMS functionality to your Go applications is smooth and efficient, giving you the opportunity to fine-tune your communication strategies without any hassle.

Here are some typical usage scenarios:

  • Implementing two-level strong authentication to increase the security of your users' accounts.
  • Sending automatic SMS notifications in response to your customers' actions in the application.
  • Implement SMS promotional campaigns, specifically targeting your users.
  • Automate message delivery for abandoned cart reminders, account creation confirmations, purchase finalizations or order shipment announcements.
  • Instant delivery of alerts in case of emergency or service interruption.

Why choose SMSFactor's SMS Go API?

Our major asset is our team! Our expert developers are always ready to help you integrate our SMS Go API, and are available to provide any assistance you may need.

When it comes to security, you can rest easy! Send your messages with confidence, thanks to our 99.9% uptime rate. Your customers are protected, as our services scrupulously comply with RGPD regulations. What's more, we provide you with automated anti-flood systems to prevent any overflow.

And to top it all off, our API is constantly being enriched with new features:

  • Test your configurations via sending simulations, without disturbing your customers.
  • Automate unsubscribe management to respect your customers' choice to stop receiving SMS messages.
  • Receive read confirmations and SMS responses for detailed tracking.
  • Use webhooks to fine-tune SMS dispatch data.
  • Integrate short, traceable links to analyze traffic from your messages.