utalk

mail@pastecode.io avatar
unknown
javascript
3 years ago
886 B
2
Indexable
Never
function uTalkSend2(phoneNumber,messageID,messageContent) {

  var urlBase = "https://v1.utalk.chat/send/6agfs28/?cmd=chat&id=";
  var urlPhone = "&to=" + phoneNumber + "@c.us";
  var urlMsg = "&msg=" + messageContent;
  var urlFinal = urlBase + messageID + urlPhone + urlMsg;


 var headers = {
    "Content-type" : "application/x-www-form-urlencoded"
  };
  var data = {
    "cmd" : "chat",
    "id" : messageID,
    "to" : phoneNumber + "@c.us";
  };
  var payload = {
    "data" : Utilities.jsonStringify(data)
  };
  var options = {
    "method" : "post",
    "headers" : headers,
    "payload" : payload
  };

  var response = UrlFetchApp.fetch(urlFinal,options);
  Logger.log(response.getContentText());
  
  //var fact = response.getContentText();
  //var sheet = SpreadsheetApp.getActiveSheet();
  //sheet.getRange(1,1).setValue([fact]);

  return response.getContentText();