I would like you to automatically enter the person who executed this script in the vertxt=';
section. What should I do from here?
We have removed some of the var url
parts for confidentiality.
function onOpen2(){
varurl='https://chat.googleapis.com';
var text = 'Automatically insert viewer's name';
var payload = {
"text"—text
}
varjson=JSON.stringify(payload);
var options = {
"method": "POST",
"contentType": 'application/json; charset=utf-8',
"payload": json
}
var response=UrlFetchApp.fetch(url, options);
Logger.log(response);
}
The email address (login ID) of the current session user (the user who opened the GAS) can be obtained from Session.getActiveUser().getEmail()
.
Documentation: Session.getActiveUser()
However, only getEmail()
methods are available for users who can obtain only the email address (login ID).If you also want to get a user's name, you will need to get the user information from that email address using Directory API.
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.