概要 スクリプトを使って,支払い情報の取得設定や通知できるようにするためにはどうすれば良いかを説明します。 Google Cloud Platform(以下GCP)の支払い情報をBigQueryにエクスポートして,GCFで集計してSlackに通知するスクリプトを作りました. 下のような通知が日時でSlackに届きます.かっこの中身は前日の金額との差(昨日より増えてるか減ってるか)です. オプション設定によりプロジェクトの内訳も表示できるようになります。(一番下を参照) デプロイコマンドも同封しているので、slack api tokenとBigQueryのエクスポート設定をすれば任意のチャネルに通知を飛ばせるようにできます。 スクリプトはこちら(Github) 使用するもの ・BigQuery ・Google Scheduler ・Google Cloud Functions ( Node.
gistfile1.gs ��dT�U �\lT�U // slackのwebhook URL var postUrl = "https://hooks.slack.com/services/xxxxxxxxxxx"; // 通知したいslackのチャネル(部屋) var postChannel = "#n_app_review"; // 抽出元のGmailのラベル var checkLabel = "TO_ME"; function myFunction() { // 未読の指定ラベル を検索 var threads = GmailApp.search('is:unread label:' + checkLabel); var count = threads.length; Logger.log("対象件数:" + threads.length); for(var i = 0; i <
お金とかソース管理とか何も考えなくていいスクレイピングbotを作りたい 「SlackにStackShare.ioからトレンドランキング拾って投稿するbot作って」「ほいきた」 Slackのbotってhubotとかいう奴の事でしょ?皆作ってるし余裕だろ、と何も考えずに引き受けたら何やらサーバが必要だわyo hubotしたらファイルが2000個自動生成されるわ、で速攻ぶん投げたくなりました。目的が単純ならその実装も運用も管理も可能な限りシンプルにしたいものです。探してみたところ、Google Apps Scriptが一番手軽そうだったので早速やってみました。 PaaSやIaaS系のサービスとかでは全然無いです。ざっくり言えばGoogleドライブにスクリプトをアップしておくだけ。 新規⇢アプリを追加⇢Apps Scriptを検索、追加しておきます。 プログラミング 新規⇢その他⇢Google A
本日の予定一覧をつぶやくbotは多いけど、予定に設定してある通知の時刻になったら教えてくれるbotが見当たらなかったので GAS(Googls Apps Script) で作ってみた。 (Slack の Integration API に Google Calendar はあるんだけど、これも予定の時間になったら教えてくれるだけで、5分前とか教えてくれない) チーム全体のカレンダーを登録して使用する事を想定しています。 例えば、午前9時〜12時に「午前中停電の為、出社できません」というイベントを作り、ポップアップ通知を前日の9時と18時に設定しておくと、以下のメッセージが表示されます。(たぶんきっと) 会議の時間は忘れなくても、こういうのウッカリしがち。 もちろん会議の5分前に通知を出す事も出来ますよ。(4分前ぐらいになるかもだけど) 注意事項 GASへ貼り付ける時は Javascript
最近 GAS(Google Apps Script) や SlackBot の存在を知って、慣れていけばいろいろ捗りそうな気がしたので触ってみた時のメモ。 今は特に GAS で自動化したいようなものは無かったので、SlackBot と連携して簡易的な日程調整、出席管理アプリを作って遊んでみました。JavaScript 自体も全然触ったことがなかったので、少しは勉強になったかなと思います。尚、実用性は皆無だと思われ(ry 簡単に今回作ったアプリの説明 Slack 上で日程調整ができるアプリです。特定のチャンネルから特定のワードを付けてメッセージを投稿すると、Google Spread Sheet と連携して出席状況の管理などをしてくれます。 イベントの登録 新しくイベント(予定)を追加するには以下の形式でメッセージを投稿します。 新: [イベント名] [日付(M/d)] ... [日付(M/
サービスが置かれているデータセンターと同じ場所でZabbixやNagiosなどを動かして死活監視を実行していますが、データセンター自体のネットワークや電源のトラブルなどで監視サーバごとダメになってしまうケースがあったので外部からURL監視だけでもやっておこうと思い簡単にできる方法を調べていたところ以下の記事を見つけました。 Google Apps Script でWEB死活監視(複数URL編)dozensmembers.wordpress.com 基本はこの記事のものでも良かったのですが少し欲が出てきて、以下のような仕様を盛り込んだものを作成してみました。 スプレッドシートで監視するURLを追加、削除したい 通知先をURLごとに設定できるようにしたい URL Monitoring using Google AppsScript スプレッドシートは以下のようなものを作成します。 サービス名は
全国のGoogle Apps Scriptファンの皆様こんにちは Apps Scriptガチ勢の大橋です。 今年でGoogle Apps Scriptアドベントカレンダーも3年目になりました。 年々人は減っている気がしますが、BigQueryとの連携など他のアドベントカレンダーに名前が出ることが増えてきて、嬉しい限りです。 さて、ちょいSlack BotをGASで作る機会があったのでSlack API周りをGASで扱うためのLibraryを作りました。 今回はこのLibraryとそれを使って作った会議予約Botのサンプルコードについて書いていきたいと思います。 なお知らない方も多いので書いておくと、GASのLibrary機能は丁寧に作ると補完が非常に効くようになり、開発効率が10倍以上変わります。 Libraryについて詳しくは以下の記事を見て下さい。 2012年Google Apps S
この記事はCAMPHOR- Advent Calendar 2015 12日目の投稿です。 ごあいさつ 初投稿になります。見習いエンジニアの@andoshin11です。 普段は旅行会社で働いているのでそちらのリンクも貼っときます(宣伝) http://meetuskyoto.com プログラミング初心者なので開発方面のメイン業務には貢献できないのですが、みんながいつも利用するSlackを活用して業務の効率化・潤滑化を図りたいなぁと思う次第です。 CAMPHOR- Advent Calendar 2015 6日目の記事でも@kakennがSlackのTips記事を書いてくれましたが、今回は自分のようなプログラミング初心者でもサクッと実装できる簡易botをGoogle Apps Scriptを利用して実現したいと思います。 Botを活用する意義としては 業務の自動化 そして何よりも Botは癒
先日「Slackがカップル専用アプリだった件」という記事を拝見しまして、その衝撃たるやそうそうたるものでした。 その手があったか、と。 僕はもう辺りを警戒しながら、恥を忍んで、おずおずとBetweenを開く必要はないんだ、と。 思い立ったが吉日。善は急げです。 彼女を説得するもともとお互いにBetweenには多少の不満があって、ちょうど乗り換えを検討していたタイミングでした。 しかし、「Slack」のデザイン性の高さには食いついたものの、英語オンリーのUIや「Channel」等の馴染みのない機能に難色を示し気味。 僕のプレゼン力が試される時です。 僕「この『Slack』作ったスチュワート・バターフィールドっていう人、海外でめっちゃ流行った『Flickr』いう写真のSNS作った人なんだけどさ。 本当はゲーム作りたかったんだって。 でもゲーム作ってる途中で予算が尽きて、しょうがなく作りかけのゲ
Google Apps Scriptでウェブサイトの死活監視をしてSlackに通知するbotの作り方をご紹介します。サーバにホスティングする必要もなく、簡単にウェブサイトの監視を行えます。 ウェブサイトが正常に動いているのかを監視するツールは沢山あります。 弊社ではAWSのRoute53にあるHealthCheckを使っていたのですが、こちらは秒間のチェック数が半端なくて、弱いサーバだとHealthCheckの負荷でサーバダウンするっていう笑えない状況もありました。 そこでGoogle Apps Scriptを使ってウェブサイトの状態をチェックをして、さらにはSlackに通知しちゃおうと思いました。 Google Apps Scriptって? Google Apps Script、略称GASは、Googleが提供しているサービスです。 GoogleドライブでGoogle Apps Scri
2016.02.26 Google Apps Scriptを使って、スプレッドシートの内容をSlackに通知する 社内で、MTGの司会を当番制にしようということで、スプレッドシートで当番表をこさえたのですが、何かしら通知機能があるといいよなぁということでやってみました。 Google Apps Script(以降、GAS)を使って、当番表の内容をSlackに通知する、のです。 スプレッドシートの画面から、GASはどこで確認できるかというと、「ツール」から「スクリプトエディタ」を選択します。 そうすると、このような画面が ↓ ※ ここにあるキャプチャの内容で、デモを用意しようと思ったのですが、閲覧権限では再現できず、セキュリティ的な観点で断念…。 スプレッドシート内の値を処理/取得 ③の内容をどのように取得しているかというと、GASとJavascriptを使って、次のような記述をしております
私が働いている会社では、社内のコミュニケーションツールとしてSlackを利用している。 slack.com Slackはメッセージやグループチャットを綺麗なUIで使えることに加え、Google DriveやDropbox、GitHub等の様々なサードパーティとのサービス連携が豊富であることから、利用事例にもある通り主に北米で多数の利用者を獲得している。 また、Slackではbotと呼ばれる「プログラムで行動を決められるユーザー」を追加することで、特定の条件下で自動的にメッセージを投稿したりファイルをアップロードしたりすることができる。botについて詳しくはSlackのWebサイトを参照のこと。 今回は、Google Apps Scriptを使ってWebサイトをスクレイピングし、その結果をSlackに投稿するbotを作成するためにいろいろ調査をした内容を書く。 Google Apps Scr
こんにちは、Slack依存症のwakです。 監視メールが多くて困る 弊社ではゴルフ場の基幹システムを取り扱っています。 ゴルフ場内のネットワークは様々な制約がかけられていることが多々あり、外部へ許可された通信はHTTP(S)とメールだけ、ということも少なくありません。 必定、ジョブ監視結果などはメールに頼ることになります。 ですが弊社では現在【メールをなるべく減らそう】運動の真っ最中で、できることならば監視メールをチェックする業務はなくしたいところです。面倒ですからね。 今回も本文と特に関係のないかわいい猫 GASとは? そこで登場するのがGoogle AppsとGAS(Google Apps Script)です。 GASを一言で表現すると、 Gmail, Google Drive, Google Docsなど、 Googleの各種サービスをお手軽に呼び出せるスクリプト環境(サーバーサイド
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く