Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zapierを使ったGoogle FormとNotion DBの連携 - NIFTY Tech Talk #10

Zapierを使ったGoogle FormとNotion DBの連携 - NIFTY Tech Talk #10

More Decks by ニフティ株式会社

Other Decks in Programming

Transcript

  1. Copyright © NIFTY Corporation All Rights Reserved.
    Zapierを使った
    Google FormとNotion DBの連携
    南川 大樹
    NIFTY Tech Talk #10 「Notion活用術」
    2023/04/27

    View Slide

  2. Copyright © NIFTY Corporation All Rights Reserved. 2
    2
    南川大樹
    新卒4年目 / サービスインフラチーム
    N1! オートメーションスペシャリスト
    [メイン業務]
    SSO, ユーザーサインアップ 等...
    [Notionの好きな機能]
    • データベースの関数プロパティ
    [Notionの欲しい機能]
    • 検索クエリURL (ex. https://www.notion.so/hogehoge/search?q=nifty)
    自己紹介

    View Slide

  3. Copyright © NIFTY Corporation All Rights Reserved. 3
    背景
    Notionのデータベース機能を使ってタスク管理している。

    View Slide

  4. Copyright © NIFTY Corporation All Rights Reserved. 4
    背景
    システムに関する依頼はGoogle Formから申請してもらい、
    申請内容について手動でNotionにDB追加している。
    手動で追加するのが面倒!

    View Slide

  5. Copyright © NIFTY Corporation All Rights Reserved.
    背景
    5
    Google Formではなく、Notion DBに直接追加してもらえばいいのでは?
    依頼者が誤ってデータベースの項目を消してしまうかもしれない。
    Google Formだと必須項目の指定や各項目の説明の記述などができる。

    View Slide

  6. Copyright © NIFTY Corporation All Rights Reserved.
    解決策
    6
    やりたいこと :
    Google Formに送信された申請内容をもとに、
    Notionのデータベースに項目を自動追加する。
    Zapierを使おう!

    View Slide

  7. Copyright © NIFTY Corporation All Rights Reserved.
    Zapier とは
    7
    サービス・アプリ間を連携する自動ワークフローをノーコードで作れるサービス。
    対応しているアプリは5000以上!
    Gmail, Spread Sheet, Google Drive, Google Form, Notion, Slack, GitHub など...
    作れるワークフローの例は以下の通り。
    検索にマッチしたメールを受信したら、Slackにメッセージを送信する。
    Notionのデータベースに新しい項目が追加されたら、Spread Sheetに行を追加する。
    https://zapier.com/

    View Slide

  8. Copyright © NIFTY Corporation All Rights Reserved.
    Zapier の用語
    8
    アプリやサービスを連携させる自動化されたワークフロー。
    Zap
    Triggerと1つ以上のActionで構成される。
    Zapをオンにすると、Triggerのイベントが発生するたびにActionが実行される。

    View Slide

  9. Copyright © NIFTY Corporation All Rights Reserved.
    Zapier の用語
    9
    Zapを開始するためのイベント。
    Trigger
    Triggerの例は以下の通り。
    「検索にマッチするメールを受信したら」「NotionのDBに新しい項目が追加されたら」
    Triggerが発動した後にZapが実行するイベント。
    Action
    Actionの例は以下の通り。
    「Slackにメッセージを送信する」「Spread Sheetに新しい行を追加する」
    https://help.zapier.com/hc/en-us/articles/8496181725453

    View Slide

  10. Copyright © NIFTY Corporation All Rights Reserved.
    やりたいことをZapierに落とし込む
    10
    やりたいこと :
    Google Formに送信された申請内容をもとに、
    Notionのデータベースに項目を自動追加する。
    このようなZapを作る。
    Trigger : 「Google Formから回答が送信されたら」
    Action : 「Notionのデータベースに項目を追加する」

    View Slide

  11. Copyright © NIFTY Corporation All Rights Reserved.
    実際に作ってみる
    11

    View Slide

  12. Copyright © NIFTY Corporation All Rights Reserved.
    事前準備
    12
    Notionに依頼管理用のデータベースを作成
    プロパティとして、「タイトル」「ステータス」「依頼者」がある。
    簡単にするため、プロパティは3つのみ。

    View Slide

  13. Copyright © NIFTY Corporation All Rights Reserved.
    事前準備
    13
    依頼送信用のGoogle Formを作成
    質問内容として、「依頼者の名前」「依頼の件名」
    「依頼の内容」がある。

    View Slide

  14. Copyright © NIFTY Corporation All Rights Reserved.
    事前準備
    14
    Zapの動作確認用のダミーの回答を用意
    作成したGoogle Formで適当な内容を送信。
    右の回答から左の項目を作成することを目標とする。

    View Slide

  15. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    15
    Zapierにアクセス
    Zapierにログインし、左上の「Create Zap」ボタンを押す(Zapierのアカウント作成等は省略)。

    View Slide

  16. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    16
    Zapの名前を変更
    必要に応じて、左上からZapの名前を変更する

    View Slide

  17. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    17
    Triggerの作成
    Triggerの検索フィールドに「Google Forms」と入力し、「Google Forms」を選択する。

    View Slide

  18. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    18
    Triggerの作成
    Eventに「New Form Response」を指定し、「Continue」ボタンを押す。

    View Slide

  19. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    19
    Triggerの作成
    Google Forms accountに自分のアカウントを指定し、「Continue」ボタンを押す。

    View Slide

  20. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    20
    Triggerの作成
    Formに先ほど作成したGoogleフォームを指定し、「Continue」ボタンを押す。
    ↑ 先ほど作成したGoogleフォーム

    View Slide

  21. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    21
    Triggerの作成
    作成したTriggerのテストをするため、「Test trigger」ボタンを押す。

    View Slide

  22. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    22
    Triggerの作成
    先ほどの回答が表示されることが確認できる。確認したら、「Continue」ボタンを押す。

    View Slide

  23. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    23
    Actionの作成
    Actionの検索フィールドに「Notion」と入力し、「Notion (Latest)」を選択する。

    View Slide

  24. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    24
    Actionの作成
    Eventに「Create Database Item」を指定し、「Continue」ボタンを押す。

    View Slide

  25. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    25
    Actionの作成
    Notion accountでは、まず「Connect a new account」ボタンを押す。

    View Slide

  26. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    26
    Actionの作成
    「ページを選択する」ボタンを押す。

    View Slide

  27. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    27
    Actionの作成
    先ほど作成したデータベース名を選択し、「アクセスを許可する」ボタンを押す。
    ↑ 先ほど作成したNotion DB

    View Slide

  28. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    28
    Actionの作成
    作成したアカウントを選択し、「Continue」ボタンを押す。

    View Slide

  29. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    29
    Actionの作成
    Databaseに先ほど作成したデータベースを指定します。
    ↑ 先ほど作成したNotion DB

    View Slide

  30. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    30
    Actionの作成
    タイトルでは、「Show all options」ボタンを押し、「1. 依頼の件名」を選択する。

    View Slide

  31. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    31
    Actionの作成
    同じ要領で、依頼者とContentを入力し、
    Content Formatには「Plain Text」を指定して、
    「Continue」ボタンを押す。
    Contentはデータベースの項目の本文(赤枠)

    View Slide

  32. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    32
    Actionの作成
    「Test action」ボタンを押すと、Actionの実行結果が表示される。

    View Slide

  33. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    33
    Actionの作成
    先ほど作成したデータベースを確認すると、項目が作成されていることが確認できる。

    View Slide

  34. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの作成
    34
    Actionの作成
    Zapの編集画面に戻り、右上の「Publish」ボタンを押すと、Zapが有効化される。

    View Slide

  35. Copyright © NIFTY Corporation All Rights Reserved.
    Zapの動作確認
    35
    Zapを有効化した状態で、Google Formから回答を送信すると、
    その内容がNotionのデータベースに項目として追加される。

    View Slide

  36. Copyright © NIFTY Corporation All Rights Reserved.
    まとめ
    36
    Zapierを使うことで、Notionと様々なサービスの連携をする
    自動ワークフローをノーコードで作れる。
    Actionをさらに追加して、DBに項目が追加されたことを
    Slackのチャンネルに通知することもできる(有料プランのみ)。
    Zapierを使ったNotionの自動化の例は公式サイトに載ってる。
    https://zapier.com/apps/notion/integrations

    View Slide

  37. Copyright © NIFTY Corporation All Rights Reserved.
    参考資料
    37
    Zapier | Automation that moves you forward
    https://zapier.com/
    Learn key concepts in Zapier – Zapier
    https://help.zapier.com/hc/en-us/articles/8496181725453
    Notion Integrations | Connect Your Apps with Zapier
    https://zapier.com/apps/notion/integrations
    How to use Zapier to automate Notion—and turn it into the perfect information hub | Zapier
    https://zapier.com/blog/automate-notion/

    View Slide

  38. Copyright © NIFTY Corporation All Rights Reserved.

    View Slide