GAS로 Rocket.Chat에 게시
Rocket.Chat 설정
게시할 채널 만들기
프라이빗에서도 문제 없다.
「_」는 「-」가 되어 버리거나, 왠지 이상한 거동하기 때문에, 가능하면 사용하지 않는 편이 안전같다.
서비스 연계 설정
이름, 채널 및 사용자 등록
※ 유효하게 해 잊지 않는다!
하단의 "변경 저장"을 누릅니다.
"Webhook URL"과 "Token"메모
명령줄에서 실행
curl 부분을 복사하고 명령 줄에서 실행해보십시오.
curl -X POST -H 'Content-Type: application/json' --data '{"text":"Example message"・・・
이런 식으로 표시되면 OK
GAS에서 실행
function myFunction(){
var message = 'テスト :birthday: google apps script';
sendRocketChat(message);
}
function sendRocketChat(message){
var payload = {
"text": message,
"attachments": [
{
"title": "Rocket.Chat",
"title_link": "https://rocket.chat",
"text": "Rocket.Chat, the best open source chat",
"image_url": "https://rocket.chat/images/mockup.png",
"color": "#764FA5"
}
]
};
var options = {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(payload)
};
var token = 'your token';
var url = 'your webhook url' + token;
UrlFetchApp.fetch(url, options);
}
↓사용자 이름이라든지 지우고 있습니다
Reference
이 문제에 관하여(GAS로 Rocket.Chat에 게시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/_saki_kawa_/items/a40709c59d38642faacd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)