Code Snippet Example

    var myHeaders = new Headers();
    myHeaders.append("XApiKey", "MY API KEY");
    myHeaders.append("Content-Type", "application/json");

    var raw = JSON.stringify({
      "from": "sender Id",
      "body": "My message",
      "to": "country code + phone number"
    });

    var requestOptions = {
      method: 'POST',
      headers: myHeaders,
      body: raw,
      redirect: 'follow'
    };

    fetch("https://ypapikey.azurewebsites.net/SMS", requestOptions)
      .then(response => response.text())
      .then(result => console.log(result))
      .catch(error => console.log('error', error));

Last updated