G-Sheet script to post a message on Guilded using its API

Viewed 22

I am trying to create a script to post a text message in a chat on Guilded, but so far I get a "POST is not allowed" Message should be "inPrivate" so a mention of the targeted member is required.

Google sheet test file

my script:

function message ()  {
  var url = "https://www.guilded.gg/api/v1/channels/";
  var channelid = "d2ba*****";
  var key = "Bearer gapi_*****";  //Q-P API temp-bot

  const message = {
    content : "It's alive!",
    embeds :[{
      author:"API",
      mentions:"Raven_test",
    }],
    isPrivate : true,
  }

  const params = { 
    method: "POST",
        headers: { Authorization: key },
        contentType: "application/json",
    payload: JSON.stringify(message),
    muteHttpExceptions: true,
  };
  
  Logger.log(JSON.stringify(params));

  const response = UrlFetchApp.fetch(url + channelid + "/messages/", params);
  var data = JSON.parse(response);
  Logger.log(data);

}

Guilded's API

I don't understand what I'm doing wrong (but I'm a newbie, so it makes sens)

0 Answers
Related