Exemple Go


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://secure.smsvendor.com/token.html

  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.smsvendor.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)
}