การดำเนินการในคลิกเดียว

การดำเนินการแบบคลิกเดียวช่วยให้ผู้ใช้ดำเนินการได้โดยตรงจากกล่องจดหมายโดยไม่ต้องออกจาก Gmail การดำเนินการในคลิกเดียวนั้นทำได้โดยการประกาศ HttpActionHandler พร้อม URL ของบริการ ดูรายละเอียดเพิ่มเติมได้ที่การจัดการคำขอการดำเนินการ

ปุ่มยืนยันใน Gmail
การดำเนินการใน Gmail ด้วยคลิกเดียว

กรณีการใช้งาน

การดำเนินการในคลิกเดียวที่ Gmail รองรับมีดังนี้

ยืนยันการทำงาน

คุณอาจเพิ่มปุ่มยืนยันแบบคลิกเดียวในอีเมลที่กำหนดให้ผู้ใช้ต้องอนุมัติ ยืนยัน และรับทราบข้อมูลบางอย่างได้ เมื่อผู้ใช้คลิกปุ่มดังกล่าว Google จะออกคำขอ HTTP ไปยังบริการของคุณ ซึ่งจะบันทึกการยืนยัน โต้ตอบกับ ConfirmAction ได้ครั้งเดียวเท่านั้น

ประกาศต่อไปนี้เพิ่มปุ่ม ConfirmAction ลงในอีเมลเกี่ยวกับรายงานค่าใช้จ่าย

JSON-LD

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "potentialAction": {
    "@type": "ConfirmAction",
    "name": "Approve Expense",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "https://myexpenses.com/approve?expenseId=abc123"
    }
  },
  "description": "Approval request for John's $10.13 expense for office supplies"
}
</script>

Microdata

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ConfirmAction">
    <meta itemprop="name" content="Approve Expense"/>
    <div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
      <link itemprop="url" href="https://myexpenses.com/approve?expenseId=abc123"/>
    </div>
  </div>
  <meta itemprop="description" content="Approval request for John's $10.13 expense for office supplies"/>
</div>

บันทึกการกระทำ

SaveAction สามารถใช้เพื่ออธิบายการโต้ตอบ เช่น การบันทึกคูปองหรือเพิ่มเพลงลงในคิวการฟัง โต้ตอบกับ SaveAction ได้ครั้งเดียวเท่านั้น

การประกาศต่อไปนี้จะเพิ่มปุ่ม SaveAction ในอีเมลเกี่ยวกับข้อเสนอ

JSON-LD

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "potentialAction": {
    "@type": "SaveAction",
    "name": "Save Offer",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "https://offers-everywhere.com/save?offerId=xyz789"
    }
  },
  "description": "$5 meal at Joe's Diner"
}
</script>

Microdata

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/SaveAction">
    <meta itemprop="name" content="Save Offer"/>
    <div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
      <link itemprop="url" href="https://offers-everywhere.com/save?offerId=xyz789"/>
    </div>
  </div>
  <meta itemprop="description" content="$5 meal at Joe's Diner"/>
</div>

ทดสอบมาร์กอัปของคุณ

คุณสามารถตรวจสอบมาร์กอัปโดยใช้เครื่องมือทดสอบอีเมลมาร์กอัป วางโค้ดมาร์กอัปแล้วคลิกปุ่มตรวจสอบความถูกต้องเพื่อสแกนเนื้อหาและรับรายงานเกี่ยวกับข้อผิดพลาดที่เกิดขึ้น

ข้อมูลจำเพาะ

สำหรับพร็อพเพอร์ตี้ที่ใช้ได้กับการดำเนินการเหล่านี้ โปรดดูเอกสารสำหรับประเภท ConfirmAction และ SaveAction ที่เจาะจง