Skip to content

Instantly share code, notes, and snippets.

@kiuchikeisuke
Created June 20, 2018 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiuchikeisuke/66e7783cd929c6b2b859eecd67266779 to your computer and use it in GitHub Desktop.
Save kiuchikeisuke/66e7783cd929c6b2b859eecd67266779 to your computer and use it in GitHub Desktop.
Gmailに来るConnpass通知をいい感じにSlackに通知する ref: https://qiita.com/k_keisuke/items/072086fa760300ac060b
var messages = thread.getMessages();
var message = messages[0];
var subject = message.getSubject();
var body = message.getBody();
var url = body.match(/<a href="https:\/\/.+\.connpass\.com\/event\/.+\/.+utm_content=detail_btn"/);
if(url != null) {
url = url[0].substring('<a href="'.length, url[0].lastIndexOf('/') + 1);
var msg = "*" + subject + "* \n" + url;
postToSlack(msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment