Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2021
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var headerNames = ["Authorization"];
  2. var headerValues = ["Bearer " + accessToken];
  3. var smsEndpoint = "https://mcvwf-nkxrzjq7703k4qnp23fgt1.rest.marketingcloudapis.com/"; //provide rest endpoint
  4. var smsPayload = '{';
  5. smsPayload += '"mobileNumbers": [';
  6. smsPayload += '"34xxxxxxxxx"'; //pass phone number country code + pnonenumber
  7. smsPayload += '],';
  8. smsPayload += '"Subscribe": true,';
  9. smsPayload += '"Resubscribe": true,';
  10. smsPayload += '"keyword": "TriggeredSMS"'; //provide KEYWORD
  11. smsPayload += '};';
  12.  
  13. var smsAPIKey = "NzQ4Ojc4OjA";
  14.  
  15. var smsUrl = smsEndpoint + "/sms/v1/messageContact/" + smsAPIKey + "/send"; //provide message API key
  16.  
  17. try {
  18.  
  19. var sendSMS = HTTP.Post(smsUrl, contentType, smsPayload, headerNames, headerValues);
  20.  
  21. } catch (error) {
  22. Write('<h1>SMS call</h1></br>');
  23. Write('smsUrl: ' + smsUrl + '</br>');
  24. Write('smsPayload: ' + smsPayload + '</br>');
  25. Write(Stringify(error));
  26. Write('</br>');
  27. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement