Skip to content

Instantly share code, notes, and snippets.

@kaiinui
Last active August 29, 2015 14:19
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 kaiinui/fe5e9d7987022811444a to your computer and use it in GitHub Desktop.
Save kaiinui/fe5e9d7987022811444a to your computer and use it in GitHub Desktop.
Gmail In-Box Actions の調査
  • One-Click Action
  • Rsvp Action
  • Review Action
  • Go-To Action

の 4 つがある。

それぞれ受信メール一覧画面にて、当該メールの右のほうに表示される。

ユーザはメールを見ること無しにこのボタンから直接アクションを起こす事が出来る。

Review Action はメール内にも強力な導線があった

それぞれ

  • ワンクリックで、Gmail から離脱することなしに自由な HTTP リクエストを発行出来る One-Click Action (e.g. Mail Chimp の Confirm Subscription)
  • 「はい」「いいえ」「多分」から返答を選択することが出来る Rsvp Action
  • 「星の数」を選択しレビューを書き込む HTTP リクエストをその場で発行出来る Review Action
    • 「本文」もオプションで要求する事が出来る
  • ボタンから直接指定した URL にジャンプすることの出来る Go-To Action (e.g. Amazon の荷物追跡や注文表示)

使い方

  1. https://developers.google.com/gmail/markup/reference/index を読む
  2. テスト方法
  • https://script.google.com/ で次のようなスクリプトと HTML を用意
  • HTTP リクエストを受ける URL は requestb.in がおすすめ
function myFunction() {
  var htmlBody = HtmlService.createHtmlOutputFromFile('review_action').getContent();

  MailApp.sendEmail({
    to: Session.getActiveUser().getEmail(),
    subject: 'Test Email markup - ' + new Date(),
    htmlBody: htmlBody,
  });
}
<html>
  <head>
    <script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "action": {
    "@type": "ReviewAction",
    "name": "レビューする",
    "review": {
      "@type": "Review",
      "itemReviewed": {
        "@type": "FoodEstablishment",
        "name": "Joe's Diner"
      },
      "reviewRating": {
        "@type": "Rating",
        "bestRating": "5",
        "worstRating": "1"
      }
    },
    "handler": {
      "@type": "HttpActionHandler",
      "url": "http://requestb.in/1lyfre61",
      "requiredProperty": {
        "@type": "Property",
        "name": "review.reviewRating.ratingValue"
      },
      "optionalProperty": {
        "@type": "Property",
        "name": "review.reviewBody"
      },
      "method": "http://schema.org/HttpRequestMethod/POST"
    }
  },
  "description": "We hope you enjoyed your meal at Joe's Diner. Please rate your experience."
}
</script>
  </head>
  <body>
    <p>
      This a test for a Go-To action in Gmail.
    </p>
  </body>
</html>

結果

細かい事

  • 文法エラーとかあると表示されない(すごくデバッグしにくい)
  • GAS 使うとまあまあデバッグ出来る
  • 送信元アドレスによって出来たり出来なかったりする?調査必要。
  • Actionname を弄るとボタンのラベルが変わったりする Go-To Action のみ検証
  • One-Click Action のクリックは一度のみ
  • Go-To Action と One-Click Action は name で名前を変えられる
  • Review Action は name で名前を変えられない。星のみだと 評価, 本文を要求すると クチコミ となる
  • Review Action では bestRating は 5, worstRating は 1 限定。(要は 5 つ星評価のみ)
@kaiinui
Copy link
Author

kaiinui commented Apr 24, 2015

なぜか RSVP Action だけ上手く行かない。
公式の JSON-LD 使ってもダメ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment